Better way to Authenticate user using Login Page

Posted by Learningtorise under ASP.NET on 11/6/2013 | Points: 10 | Views : 1660 | Status : [Member] | Replies : 3
I have a application in ASP.Net C# 4.0
There's a Login Page and a HomePage.
Upon Login, i create a session variable 'EmpCode' and redirect to HomePage.
On HomePage, i am checking whether session variable 'EmpCode' exists or not. If not then i am redirecting it to Login Page.

As per requirement, I have added 10 more pages in my application.

Is there better way to authenticate user without having copy paste function to check session 'EmpCode' on each Page's Load Event.

http://hashtagakash.wordpress.com/


Responses

Posted by: Allemahesh on: 11/6/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
If you using master page concept, you can check session 'EmpCode' on master page instead of each page. So this will help you to avoid copy and past the code on each page.

Happy Coding.


Happy Coding,
If it helps you or directs U towards the solution, MARK IT AS ANSWER

Learningtorise, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Learningtorise on: 11/6/2013 [Member] Starter | Points: 25

Up
0
Down
Unfortunately, there's no Master Page!

Is there anything we can do using Global asax or Web.Config or anything else??

TIA

http://hashtagakash.wordpress.com/

Learningtorise, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response