473,388 Members | 1,230 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Expected ; in ASP page...

Hello All,
I'd like to get the network username by using the
Request.ServerVariables("AUTH_USER"). The code I've got is pretty
simple yet I am getting error. If the user does not logon they should
get a msg saying that they must logon, otherwise I wanted to place the
username in label1.text. The .aspx page is on a IIS5 server with
Scripts & Executables enabled. The error appears on line 3, char 9.
Expected: ';'

Can anyone spot what I am missing? Many thanks...

James

Here is what is returned by the server:
<%@ Page Language="VB" %>
<script runat="server">
Sub Button1_Click(sender As Object, e As EventArgs) ' error on
this line
If Request.ServerVariables("AUTH_USER") = "" Then
Response.Status = "401 Unauthorized"
Response.Write "<h1>You must logon</h1>"
Response.End
Else
label1.text = Request.ServerVariables("AUTH_USER")
End If
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:Label id="Label1" runat="server"
width="105px"></asp:Label>
<asp:Button id="Button1" onclick="Button1_Click"
runat="server" Text="Get User"></asp:Button>
<!-- Insert content here -->
</form>
</body>
</html>
Nov 18 '05 #1
2 1261
dont know really whats wrong but i changed the response.write by putting ( )
and the code worked perfect for me then

Response.Status = "401 Unauthorized"
Response.Write("<h1>You must logon</h1>")
Response.End

Greetings,

Richard

"James" <jg********@danville.k12.pa.us> schreef in bericht
news:a9**************************@posting.google.c om...
Hello All,
I'd like to get the network username by using the
Request.ServerVariables("AUTH_USER"). The code I've got is pretty
simple yet I am getting error. If the user does not logon they should
get a msg saying that they must logon, otherwise I wanted to place the
username in label1.text. The .aspx page is on a IIS5 server with
Scripts & Executables enabled. The error appears on line 3, char 9.
Expected: ';'

Can anyone spot what I am missing? Many thanks...

James

Here is what is returned by the server:
<%@ Page Language="VB" %>
<script runat="server">
Sub Button1_Click(sender As Object, e As EventArgs) ' error on
this line
If Request.ServerVariables("AUTH_USER") = "" Then
Response.Status = "401 Unauthorized"
Response.Write "<h1>You must logon</h1>"
Response.End
Else
label1.text = Request.ServerVariables("AUTH_USER")
End If
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:Label id="Label1" runat="server"
width="105px"></asp:Label>
<asp:Button id="Button1" onclick="Button1_Click"
runat="server" Text="Get User"></asp:Button>
<!-- Insert content here -->
</form>
</body>
</html>

Nov 18 '05 #2
Try changing the Language="VB" directive to Language="VBScript"

"James" <jg********@danville.k12.pa.us> wrote in message
news:a9**************************@posting.google.c om...
Hello All,
I'd like to get the network username by using the
Request.ServerVariables("AUTH_USER"). The code I've got is pretty
simple yet I am getting error. If the user does not logon they should
get a msg saying that they must logon, otherwise I wanted to place the
username in label1.text. The .aspx page is on a IIS5 server with
Scripts & Executables enabled. The error appears on line 3, char 9.
Expected: ';'

Can anyone spot what I am missing? Many thanks...

James

Here is what is returned by the server:
<%@ Page Language="VB" %>
<script runat="server">
Sub Button1_Click(sender As Object, e As EventArgs) ' error on
this line
If Request.ServerVariables("AUTH_USER") = "" Then
Response.Status = "401 Unauthorized"
Response.Write "<h1>You must logon</h1>"
Response.End
Else
label1.text = Request.ServerVariables("AUTH_USER")
End If
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:Label id="Label1" runat="server"
width="105px"></asp:Label>
<asp:Button id="Button1" onclick="Button1_Click"
runat="server" Text="Get User"></asp:Button>
<!-- Insert content here -->
</form>
</body>
</html>

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chuck Martin | last post by:
I am having a most frustrating problem that references, web searches, and other resources are no help so far in solving. Basically, I'm trying to design a pop-up window to be called with a funciton...
3
by: undercups | last post by:
When I run page I immediatley get "Object expected" message and the tag <body onload="setfocus()" is highlighted. The error occurs in this snippet from within the script file function...
35
by: Marchel | last post by:
For a long time I was a gib fan of Borland C++ Builder with VCL framework and never gave a second look in Microsoft products since I've seen MFC. Anyway, recently Borland decided out of the blue to...
14
by: Tom.PesterDELETETHISSS | last post by:
Hi, I think this question requires an in depth understanding of how a browser cache works. I hope I can reach an expert here. I may have found a quirk in the asp.net documentation or I don't...
4
by: Kiyomi | last post by:
Hello, I am trying to replace my alert message box with a popup page. In my page behind,
4
by: Momi | last post by:
Hi i m facing a problem while i click on a mail at hotmail inbox , it does nothing and on the left bottom of the page , it shows " Error on page." when i click on this , a lil pop up window opens...
4
by: hatem0 | last post by:
Hi all I don't know if I am in the right forum, I hope that someone can help me. I am not a programer, my problem is when I open a website like facebook or howstuffworks the page don't open...
2
by: Jinx08 | last post by:
I am probably an itermediate user when it comes to flash however I am at a loss with this problem. I have posted numerous flash files to the internet and never had this problem however the key there...
2
by: thj | last post by:
Hi. I've got this form that I'm trying to validate: <form id="periodForm" action="" method="post"> <p> Periode: <input id="startDate" name="startDate" type="text" size="7" value="<%=...
2
by: tridirk | last post by:
Hi; I am getting a Objceted Expected Error on my forum site. I can't find what is wrong? Line: Char: Error: Object expected Code:0 the site is My SMF Forum
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.