954,595 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

load aspx page based on session parameter

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.

purell
Newbie Poster
2 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
 

C# syntax:

if(Session["login name"]!=null)
  {
     string name=Session["login_name"].ToString();
     if(name=='put_text_here')
       {
        }
   }
__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

Hi Adatapost!!

Where do i put this code?

In Page_Load event ?

Or in the page that calls this page?

purell
Newbie Poster
2 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
 

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')
       {
        }
   }
 }
__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: