|
The ASP.NET HttpSessionState class provides a useful IsNewSession( ) method that returns true if a new session was created for this request. The key to detecting a session timeout is to also look for the ASP.NET_SessionId cookie in the request. If this is a new session but the cookie is present, this indicates a timeout situation.
public class basePageSessionExpire : System.Web.UI.Page
{
public basePageSessionExpire()
{
}
override protected void OnInit(EventArgs e)
{
base.OnInit(e);
//It appears from testing that the Request and Response both share the
// same cookie collection. If I set a cookie myself in the Reponse, it is
// also immediately visible to the Request collection. This just means that
// since the ASP.Net_SessionID is set in the Session HTTPModule (which
// has already run), thatwe can't use our own code to see if the cookie was
// actually sent by the agent with the request using the collection. Check //if
// the given page supports session or not (this tested as reliable indicator
// if EnableSessionState is true), should not care about a page that does
// not need session
if (Context.Session != null)
{
//Tested and the IsNewSession is more advanced then simply checking if
// a cookie is present, it does take into account a session timeout, because
// I tested a timeout and it did show as a new session
if (Session.IsNewSession)
{
// If it says it is a new session, but an existing cookie exists, then it must
// have timed out (can't use the cookie collection because even on first
// request it already contains the cookie (request and response
// seem to share the collection)
string szCookieHeader = Request.Headers["Cookie"];
if ((null != szCookieHeader) && (szCookieHeader.IndexOf("ASP.NET_SessionId") >= 0))
{
Response.Redirect("sessionTimeout.htm");
}
}
}
}
}
Ref : http://72.14.253.104/search?q=cache:UCFMZaCa5XEJ:aspalliance.com/520+session+time+asp.net&hl=en&gl=in&ct=clnk&cd=5&client=firefox-a
Keep Smiling !!!
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
How to take difference of any float values in ASP.NET?
e.g 6.30-5.30
dhaval
|
|
|
|
|
wrote: How to take difference of any float values in ASP.NET?
e.g 6.30-5.30
The answer to that question is so extremely obvious, that you have to mean something completely different. What do you mean?
---
Year happy = new Year(2007);
|
|
|
|
|
Hi,
i have one link button in .aspx page, if i click that link button it needs to redirect to some other page. But the problem is that it is not redirecting to that page. But if i am using Mozilla browser it is working.
can anybody guide to me,how to solve this problem.
|
|
|
|
|
While running an asp project error coming as can't debug the project.Even i installed the visual studio properly.Message comes as "The Url for this prject is in internet zone"
Praveen.K
Graviton technologies Pvt.Ltd
|
|
|
|
|
Where is the app ? Is it on your local machine ?
What if you run the app, then attach the debugger to the asp.net process ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
yahh working on a local machine..and how can i attach the debugger?
Praveen.K
System Engineer
Graviton Technologies Pvt.Ltd
|
|
|
|
|
Attach to process, and it's called aspnet_wp.exe
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
the aspnet_wp.exe attached but still not getting debugged.
Praveen.K
System Engineer
Graviton Technologies Pvt.Ltd
|
|
|
|
|
Then you're not running the site from that location.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
how can i run the site from localhost?,one more error appearing"Integrated windows authentication not enabled"
-- modified at 4:23 Tuesday 23rd January, 2007
Praveen.K
System Engineer
Graviton Technologies Pvt.Ltd
|
|
|
|
|
I'm creating a web application,there have 2 solution in seperate folders one contain all the DataAccess,BizObject(SolutionA) and other one contain my UI(SolutionB) part,i did all the report documents in SolutionA and in UI part i different web form there have CrystalViewer(Lets say FormR),
My problem is in my SoultionB there havc many UI's for that puticular applications,when i need to pass parameter to my CrystalReport form(Ex:i need to pass ID and get records accoding to that ID),how do i pass that parameter to FormR(CrystalReportViwer) form.
Note-:In my SolutionB i have create Method,which contain my dataset and TableAdapter objects and so on.
Pls help me to do this.
Thank You.....
|
|
|
|
|
You can pass data between forms by cross posting, by placing it on the URL, or by placing it in the session.
Or you can merge pages to use one page ( make them controls, and only show one at a time ), then you can just pass the values across ( store them in viewstate )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Could u give me coding example for that pls.
|
|
|
|
|
Which one ? They are all widely documented. If your url is ShowDocument.aspx, passing showDocument.aspx?id=7 is a way to pass the Id of a document, this is a good option, as people can bookmark it. The Request.Querystring is how you access it.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Lets say i have PutValue.aspx form and ReportViwer.aspx forms in SolutionB,so i put id=2 in PutValu.aspx,i need to take the value from the PutValue form and put into the Report.aspx form.In the report.aspx form i'm calling a method from in my SlotuionA.
|
|
|
|
|
Yes, so you jump from putvalue.aspx to reportviwer.aspx?id=2, and read the id in the report viewer page from the query string.
It sounds to me like you need to buy a book on web development and work through it.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Yes,according to that id i need to show book details in Report.aspx form.Pls give sample coding for that
Thanks
|
|
|
|
|
I reiterate, if you can't follow my explanation, you should buy a book.
I can't give more details, I have no idea how your form works.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
How to restrict the level of treeview in .net 2005
|
|
|
|
|
how do you mean ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
How to restrict the level of treeview in .net 2005
actually i am using treeview control in .net 2005...
i completed complete code also...
in treeview we can add more nodes ...there is no limit.
i need to restrict the levels...
|
|
|
|
|
But, if this is a web app, the tree levels surely come from your datasource, and therefore are self limiting ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
i need only 3 levels...
how can i restrict 4th level..
|
|
|
|
|
If this is a web app, why do you have a 4th level ? what's your data source ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|