473,327 Members | 2,081 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,327 software developers and data experts.

session handling

i am using asp.net2.0 :
i am handling session in every page_load,button_clicks
using
if (Session["name"] == null)
{
Response.Redirect("Login.aspx", false);
Response.End();
return;
}
else
name = Session["name"];
please suggest me is there any alternate to handle session only once in a page
that applies to all events.

thanks and regards
murali
Jan 16 '08 #1
5 1319
Frinavale
9,735 Expert Mod 8TB
i am using asp.net2.0 :
i am handling session in every page_load,button_clicks
using
if (Session["name"] == null)
{
Response.Redirect("Login.aspx", false);
Response.End();
return;
}
else
name = Session["name"];
please suggest me is there any alternate to handle session only once in a page
that applies to all events.

thanks and regards
murali
There is something called Forms Authentication. If you use Forms Authentication, the authentication is done before your code is called....eliminating the need to check the name variable in session.

Look into Forms Authentication for more details.

-Frinny
Jan 16 '08 #2
Plater
7,872 Expert 4TB
page_load() gets called for all events, so the session check only needs to be in the page_load()
Jan 16 '08 #3
There is something called Forms Authentication. If you use Forms Authentication, the authentication is done before your code is called....eliminating the need to check the name variable in session.

Look into Forms Authentication for more details.

-Frinny
thank you for ur reply:
actually my problemis:I am handling session in page_load.but when i am clicking on a button i am redirected to another page which is different from given page in Response.Redirect().
thank you
Jan 17 '08 #4
Plater
7,872 Expert 4TB
Then check the session in the page that you redirect to.
Even if you response.redirect() in a button click event handler, page_load() is still called FIRST, then the button click event handler is called.
Jan 17 '08 #5
Frinavale
9,735 Expert Mod 8TB
thank you for ur reply:
actually my problemis:I am handling session in page_load.but when i am clicking on a button i am redirected to another page which is different from given page in Response.Redirect().
thank you
Try what Plater has suggested.
I'm a bit confused as how you can be directed to a different page than the one you have specified.
Do you have another Redirect somewhere in your code?
Are you Supposed to be redirected when you click the button??

Maybe you're being Redirected to your Login page first?
Does your Login page have a Redirect that might be happening..if so what is that case?

So yeah, as Plater has suggested, check your Session variable on your other pages...

If you're still having problems please post your Page_Load code for each page.


-Frinny
Jan 17 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sean Pinto | last post by:
Ok, you all are going to have to bear with me on this one as it is kinda complicated to explain. I am implementing a company management suite that requires Role-Based authentiations (ie. users are...
3
by: news.onet.pl | last post by:
Hello I'm biting into the following problem: HTTP is stateless protocol and thus net languages' designer had to find out session. As far as I know session handling in any of the language (PHP,...
3
by: Richard P | last post by:
I am experiencing some browser weirdness. My app uses session state to hide values I prefer to keep out of the querystring. I am testing to see what happens when cookies are fully disabled in IE...
9
by: Marcus | last post by:
Hello, Currently all of my php pages use SSL, not just my initial login. Originally I thought this would be more secure, but after thinking about things and looking at sites like Amazon and...
0
by: TaeHo Yoo | last post by:
Hi all, I am prett new in asp.net. We have a project which has classic asp and asp.net scripts. Obviously this project has a bin directory under the root directory. About 80% of this project...
1
by: Oscar Thornell | last post by:
Hi, I have an ASP.NET page that generates an Exception... The Exception is not caught in the executing method...so it propagates to..the Page_Error event handling method.. In that method the...
4
by: John Allberg | last post by:
Hi! We have a problem which is correlated to web farms and session handling and are thinking of what solution to choose. Our setup is with a web farm, one ldap server and a database cluster. ...
18
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that...
9
by: viz | last post by:
hi, i have written a class for session handling, and i want to use it to keep track of the user. After authenticating the user in login page i am storing the session info like uname etc.. in a...
9
by: Josh | last post by:
I run a Joomla website and am familiar with php in some but not all aspects. Currently I am trying to find some solutions related to session handling. Am I correct in saying that "login" is kept...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.