Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
Hi guys,
 
I want to prepared Login control, not use ASP.NET inbuilt Login view. I need your ideas to prepare this.
 
Idea 1: this method I know and work on fine, get username and password from user and fire select query in database, if database give record then user is authenticated and, user name store in session variable. If I try getting other page directly with URL then first I check the session variable. If it is not null then we load page, otherwise we redirect user to login page.
 
Now for this I need to check each and every page before loading and I think there some other way also but which I can’t get that.
 
Guys, please provide me your valuable suggestions not source code. Code I will manage.
 
Thanks in advance.
Posted 7-Apr-11 1:32am
angle57638
Comments
Amit Kumar Tiwari at 7-Apr-11 6:54am
   
"suggestions not source code" 5+ for that :D
angle57 at 8-Apr-11 2:29am
   
Hi Amit Kumar Tiwari,
Thanks for this link, but this article suggest Java scripts, if user disable the java script this option not work, second there is some code we need to write more than one page also. So I will not use this option.
Please have you any other suggestion?
Or other masters have any good suggestion?
M. Sreekanth at 13-Sep-14 8:35am
   
All you need to do is create a Base class and inherit it in all your pages. Write your validation code once. That's it.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Here is an article just for you
http://msdn.microsoft.com/en-us/library/aa478962.aspx[^]
 

Hope that helps. Good luck.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

ASP.NET authentication and authorization[^]
 
Authorization MSDN[^]
MSDN Forms Authentication[^]
One of the best ones is:-
Cookieless ASP.NET forms authentication[^]
These are few very good links for providing authorization to everypage.
If you are using MVC, you can take use of the Authorization Attribute making a custom one. That would surely work out.
 
Hope these helps you anyway.
Thanks.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Use Master page concept in your application. once you write the code for checking session variable in master page then its easy to work
  Permalink  
Comments
Nelek at 15-Feb-14 7:55am
   
Almost 3 years late :P
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Hareesh's answer is correct. Use master page concept and derive every of those pages with it on which you want to check User validation.
Write Login/Session check code in Page_Init event of master page. Now it's a very basic concept that before loading a child page, master page Page_Init will call. So your problem is solved.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 8,488
1 OriginalGriff 6,516
2 Peter Leow 3,647
3 Zoltán Zörgő 3,416
4 Richard MacCutchan 2,397


Advertise | Privacy | Mobile
Web01 | 2.8.150123.1 | Last Updated 28 Nov 2014
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100