473,832 Members | 2,292 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Expected ; in ASP page...

Hello All,
I'd like to get the network username by using the
Request.ServerV ariables("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(s ender As Object, e As EventArgs) ' error on
this line
If Request.ServerV ariables("AUTH_ USER") = "" Then
Response.Status = "401 Unauthorized"
Response.Write "<h1>You must logon</h1>"
Response.End
Else
label1.text = Request.ServerV ariables("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="Button 1_Click"
runat="server" Text="Get User"></asp:Button>
<!-- Insert content here -->
</form>
</body>
</html>
Nov 18 '05 #1
2 1279
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********@dan ville.k12.pa.us > schreef in bericht
news:a9******** *************** ***@posting.goo gle.com...
Hello All,
I'd like to get the network username by using the
Request.ServerV ariables("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(s ender As Object, e As EventArgs) ' error on
this line
If Request.ServerV ariables("AUTH_ USER") = "" Then
Response.Status = "401 Unauthorized"
Response.Write "<h1>You must logon</h1>"
Response.End
Else
label1.text = Request.ServerV ariables("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="Button 1_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="VBScr ipt"

"James" <jg********@dan ville.k12.pa.us > wrote in message
news:a9******** *************** ***@posting.goo gle.com...
Hello All,
I'd like to get the network username by using the
Request.ServerV ariables("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(s ender As Object, e As EventArgs) ' error on
this line
If Request.ServerV ariables("AUTH_ USER") = "" Then
Response.Status = "401 Unauthorized"
Response.Write "<h1>You must logon</h1>"
Response.End
Else
label1.text = Request.ServerV ariables("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="Button 1_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
9807
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 in a link. that function can have parameters for URL and window name passed to it. This works peachy in Firefox (1.0). With IE 6 (6.0.29) on two separate computers, I get an "onject expected" error. Going to the MS-based debugger just tells me...
3
2386
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 validatePage() { // select the items in the TeamDivisions listbox var i=document.TeamMaintenance.TeamDivisions.options.length -1 For (i; i>=0; i--)
35
2085
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 abandon it's C++ Builder and I decided to give a look into the .NET C++ and .NET C# products. After briefly playing with them I put them to test against each other in some floating point tasks. The outcome might surprise you. It certainly surprised...
14
2103
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 understand what the SetAllowResponseInBrowserHistory does. While researching caching I tried the code sample at the following page : http://msdn2.microsoft.com/library/97wcd0a4(en-us,vs.80).aspx
4
2365
by: Kiyomi | last post by:
Hello, I am trying to replace my alert message box with a popup page. In my page behind,
4
1307
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 with this warning message" problem with this web page might prevent it from being displayed properly or functionaly properly" in the detail of this warning messages followings are also include Line: 1 Char: 1
4
27198
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 correctly or it open but with error on page. I double click on the explamation mark, they said "object expected" in different line but the same char and code. also not only object expected I face, there is also "unterminated string constant" "object doesn't...
2
4736
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 is those were all using older versions of Flash and using windows xp. I now own Flash CS3 and I am running Windows Vista I am not sure if this has anything to do with it. Anyway I used dreamweaver to create and upload the page and file.When I go to...
2
5747
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="<%= ViewData %>" /> -
2
31784
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
9794
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10780
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10497
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10212
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9319
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5623
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5788
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4420
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3077
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.