 |
| ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 4th, 2004, 10:01 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Not calling Page Load
Hello,
I have a test form with the following code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim o As String
TextBox1.Text = "HERE"
Label1.Text = "Variables: "
For Each o In Request.ServerVariables
Label1.Text &= o & "=" & Request.ServerVariables.Get(o) & "<br>"
Next
End Sub
and it ignores it! I can't get it to utilize the page_load event! It just has the defaults. Now I have other events in it that it is triggering just fine. Anybody have any problems with this before? Could accessing the Request.ServerVariables problem (can't get it to return any servervariables) have anything to do with the MYDOOM virus (this code is on our development machine)?
Thanks,
Brian
__________________
Brian
|
|

February 4th, 2004, 10:15 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Is the whole handler getting ignored or just the server variables part?
|
|

February 4th, 2004, 10:18 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
The whole handler. Looking at the above script, the textbox is blank and the label is blank.
Thanks for your help.
|
|

February 4th, 2004, 10:19 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
On those links, I'm getting a file not found...
|
|

February 4th, 2004, 10:25 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
|
|

February 6th, 2004, 07:19 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
So if you set a breakpoint in the handler, it never hits it?
You should see a line like
this.Load += new System.EventHandler(this.Page_Load);
(or the vb equivalent) in the InitializeComponent() method that the
designer created for you. Can't imagine how that could fail to be there,
unless it got deleted by accident.
|
|

February 9th, 2004, 03:54 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Hello,
You only have to declare an event handler in C#; VB.NET uses the "handles" keyword at the end of the method to link the function to the event handler (does C# have the "handles" keyword? I do not know so please pardon my lack of knowledge). Could it be that anonymous access was turned on, and that's why it wasn't accessing the server variables?
Thanks,
Brian
|
|

February 10th, 2004, 12:28 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
In VB.net you can use the Handles keyword or you can assign the handler programmatically. In C# you must assign it.
I'm not sure what you mean by your last question because anonymous access has nothing to do with accessibility to server variables.
Peter
------------------------------------------------------
Work smarter, not harder.
|
|

February 10th, 2004, 03:47 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
I thought so too, but I'm running out of logic... Anyways I scrapped this test page. I don't know why it wasn't working, but I got it to work in the rest of my application, so I gave up. What I needed to access was "Request.ServerVariables.Get("LOGON_USER")". Whenever IIS had Anonymous Access on, this was blank. Now that it is removed, I can access the User ID to implement my application security scheme.
Thanks for all of the help everybody,
Brian
PS. I completely forgot about the "AddHandler" method; I am so used to VS.NET putting in the Handles statement for me.
|
|
 |