Click here to Skip to main content
15,913,027 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a Post_training page.....I need to check usermail in session at page load of post_training page....if usermail is empty then the page can be redirected to login page, when user login success then immediatly page must be redirected to post_training page..how can do that...?
Posted

1 solution

After login successfully you have to store user detail in session like :

Session["UserID"]="YourData"
.
.
Session["UserEmailID"]="YourData"

Then after redirect to Response.Redirect("Post_training.aspx");

On Post_training page check below code on page load event :

C#
protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
             Session["UserEmailID"]=""
             Response.Redirect("Login.aspx");
        }
    }


Please accept as answer and vote if help to you.
 
Share this answer
 
Comments
SnvMohan 11-Sep-13 7:01am    
Thank you for your answer..But i need to use all the pages like that..All the pages must have a usermail in session...if not then go to login page after login sucess then redirect to previous page...your answer can be use full for that one page...how can i do that for all pages ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900