Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional 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
 
Old February 22nd, 2005, 05:07 PM
Registered User
 
Join Date: Feb 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Session_Start event not firing.. (not Sharepoint)

I have a similiar problem to this one...

http://p2p.wrox.com/topic.asp?TOPIC_...90&whichpage=1

I am able to set and retrieve session variables that I set at page level. However, session variables I set in the Session_Start event never seem to actually get set. I used Imar's test page in the link above. Works fine as I expected. Moving the Session variable declaration to Session_Start results in it not working... :-(

 
Old February 23rd, 2005, 06:21 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Can you post the code for the global.asa or is it really that simple?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 25th, 2005, 12:02 PM
Registered User
 
Join Date: Feb 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

protected void Session_Start(Object sender, EventArgs e)
{
    Session["MyTest"] = "Hello, it works";
}

That's it all there is to it... I created a new project and everything to figure this out.

If I set a Session variable in the Page_Load of one page and call the variable on another it seems fine. But trying to set it in Session_Start does not work.

 
Old February 25th, 2005, 12:11 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Are you sure that your global.asa is hooked up to your application?

What happens when you add, say, a method to the global.asax, call that method from a ASPX page and then set a break point in the code. Does it break?

Imar




 
Old February 25th, 2005, 12:29 PM
Registered User
 
Join Date: Feb 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes it does break.

I am pretty sure the global.asax isn't hooked to my project, hut how to get it to hook is beyond me atm. :-(



 
Old February 25th, 2005, 01:07 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

If the code breaks into global.asax.cs, then I'd say your global class is connected to the application....

Imar
 
Old February 25th, 2005, 01:24 PM
Registered User
 
Join Date: Feb 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

"then I'd say your global class is connected to the application...."

I assume you mean it is "not" connected...

Can you give me some help on how I would fix this?

I have a global.asax.cs and a global.asax.resx in my project. The file I am entering the calls in the Session_Start is the Global.asax.cs.

It is included in my project per visual studio.. and it shows up in the folder on the web server... Not sure what else I can do. I have made sure that IIS has an application created? I am at a loss on what else to do.

 
Old February 25th, 2005, 01:39 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

No, I meant connected.

What I was referring to with "breaks" is that Visual Studio hits a break point when you debug the application.....

Try this:

1. Start VS.NET and create a brand new C# Web App located at http://localhost/WebApplication1

2. A Global.asax file will be created. Double click it and then follow the link to switch to code view

3. Locate Session_Start and change it to this:

protected void Session_Start(Object sender, EventArgs e)
{
    Session["MyTest"] = "Hello, it works";
}


4. While on the line Session["MyTest"].... press F9 to set a break point.

5. Verify that the dropdown on the toolbar next to the blue "Play" arrow is set to Debug

6. Hit F5 to start the application.

If all is well, your code should halt at the line with Session["MyTest"]....

Does it?

Imar
 
Old February 25th, 2005, 02:44 PM
Registered User
 
Join Date: Feb 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much for your help. Creating a new project appears to have solved my problem.

I am a bit confused though on how I can create multiple web sites without putting them all under Default Web Site.

For instance...

www.abc.com
www.def.com

Right now when I create a new web project through visual studio it puts it under..
 Default Web Site

Which means I have to go to:

http://localhost/www.abc.com/

I want to be able to directly go to the site as http://www.abc.com/

In the past I have gone into IIS created a new web site at the root level and modified the host header for that particular domain.

 
Old February 25th, 2005, 03:08 PM
Registered User
 
Join Date: Feb 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nevermind I figured it out.

Same process as usual. The thing that through me off is when I first create the new project I couldn't enter the path as http://www.abc.com/ I had to enter it as http://www.abc.com Also having frontpage extensions enabled saved a ton of trouble. I hate using them because I hate clutter but in this case it makes it so much easier.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Event Firing tobriain C# 1 June 12th, 2007 08:19 AM
Custom event not firing flegel ASP.NET 2.0 Professional 0 February 23rd, 2007 06:31 AM
onSelectedIndexChanged event not firing??? MTLedari ASP.NET 2.0 Basics 5 December 19th, 2006 10:35 AM
OnSelectedIndexChanged event not firing ethertt77 ASP.NET 2.0 Basics 2 February 20th, 2006 07:34 PM
Session_Start event not fired rl ASP.NET 1.0 and 1.1 Professional 20 February 22nd, 2005 04:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.