HI,

I would like to load a aspx page based on a session parameter.

I have a "login name" in the session parameter and i want to show this aspx page if the "login name" session parameter matches a particular "login name"

How can i do this?

Thanks in advance.

C# syntax:

if(Session["login name"]!=null)
  {
     string name=Session["login_name"].ToString();
     if(name=='put_text_here')
       {
        }
   }

Hi Adatapost!!

Where do i put this code?

In Page_Load event ?

Or in the page that calls this page?

Either in init or load event of page.

void page_load()
 {
 if(Session["login name"]!=null)
  {
     string name=Session["login_name"].ToString();
     if(name=='put_text_here')
       {
        }
   }
 }
void page_init()
 {
 if(Session["login name"]!=null)
  {
     string name=Session["login_name"].ToString();
     if(name=='put_text_here')
       {
        }
   }
 }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.