Last post Jan 14, 2016 03:03 AM by Chris Zhao
Jan 12, 2016 07:39 AM|francissvk|LINK
I have punch of ASP.Net pages. In this, they have used lot of "Session" variable. Every "Session" variables are assigned with some value in some page. I just want to know, is it possible to identify : In which page the session variable assigned/initiated
first? Like write any request handlers etc. If possible let me know. Thank you!
Jan 12, 2016 07:45 AM|oned_gk|LINK
Maybe you can store current url to session
Session["page"] = Request.Url;
Jan 12, 2016 07:52 AM|Mikesdotnetting|LINK
If the same session variables are set in a number of pages, then the place that they are initiated will be the one that the visitor landed on first. Otherwise you can search the project for "Session["whatever"] = " to see where assignment takes place.
Jan 12, 2016 07:57 AM|francissvk|LINK
Thanks for the info Mike. I already know that i can use the "Search" functionality in Visual Studio. It will not give the correct place, where the "session" variable actually assigned. So i want to know is there any other possiblities are there?, like using
Jan 14, 2016 03:03 AM|Chris Zhao|LINK
If you consider using and accessing Session variables inside the Generic Handler, you could try the following.
In order to access Session inside the Generic Handler, we need to inherit the
IRequiresSessionState interface which belongs to the
public class Handler : IHttpHandler, IRequiresSessionState
public void ProcessRequest (HttpContext context)
string name = context.Session["Name"].ToString();
context.Response.ContentType = "text/plain";
More information, you could refer to this