newbie: session & URL

J

Jeff

hey

asp.net 2.0

I prefer to send parameter between pages in a web application using GET (ex:
Default.aspx?id=1) so that the URL becomes unique so the user can add the
page to favorites...

Because I now uses a sitemap I can no longer use GET. I have to put it in a
session object... Is there a solution to make it possible to add pages to
favorite even if the parameter to the page is set in a session object?

Any suggestion?

Jeff
 
C

Chison Cai

hi jeff,
here is the code to convert session object to QueryString object (simple
object only):

private void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostBack)
{
ConvertSessionToQueryString("ABCSystem_INT_ID","id");
}
//use Request["id"] to do something.

}

private void ConvertSessionToQueryString(string sessionname, string
querystringname)
{
if (Session[sessionname]!=null&&Request[querystringname]==null)
{
string id = Session["SystemName_ObjectName_ID"].ToString();
Response.Redirect("Default.aspx?id="+id,true);
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top