|
hello.
i have an ASP.NET login page. this page related to a SQL Server 2000 database and check username & password and if true , redirect people to first page of my site , for example "/forum/firstpage.html" ... if a user directly write the address of my first page (not address of my login page) , he/she will be entered to my site without login!!! it is my problem. i think if i put a cookie to user's system when he submitted to my site (and loginned successfully) , and i check "existing" of this cookie in the top of all pages of my site , no one can access to any page of my site directly. is it a solve? ... if it is , can you help me about a code that check "existing" of a cookie in a hard disk? ... i need a code to do this and if you have a better suggestion about my problem , help me by telling that to me.
thank you reader...
|
|
|
The "better way" is to use ASP.NET's built-in security methods. Their is a "Security" class in the .NET Framework. It handles all the cookie authoring and checking, plus redirection to a login page, for you.
You need to research "Forms Authentication". A Google search for "ASP.NET Forms Authentication" will reveal hundreds of results, with articles and tutorials.
You can then take if from their, by writing custom authentication code if you like.
Thomas D. Greer www.tgreer.com
|
|
|
|
|
|
|
|
|
|