Expected ; in ASP page...

  • Thread starter Thread starter James
  • Start date Start date
J

James

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>
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top