IIS - Allow access only to login.aspx
-
Hello, I'm developing an webapp that uses sql authentification to am mssql server. I've created the login page which redirects to main page if succesful login. How can i restrict access to every other page in IIS? Ex: if i tyoe http://localhost/rms it opens the login.aspx page if i type http://localhost/main.aspx it opens the main page without auth and i don't want to
-
Hello, I'm developing an webapp that uses sql authentification to am mssql server. I've created the login page which redirects to main page if succesful login. How can i restrict access to every other page in IIS? Ex: if i tyoe http://localhost/rms it opens the login.aspx page if i type http://localhost/main.aspx it opens the main page without auth and i don't want to
There are lots of things you can do. But the simplest one is Create a
BasePage
which you will inherit from Pagepublic class BasePage : Page
in the page_load Check a session variable. Sayif(Session["IsAuthenticated"] = true)...
Now inherit every page from BasePage except Login page. If login is successful setSession["IsAuthenticated"] = true;
Hope this help you. :rose:Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.
-
Hello, I'm developing an webapp that uses sql authentification to am mssql server. I've created the login page which redirects to main page if succesful login. How can i restrict access to every other page in IIS? Ex: if i tyoe http://localhost/rms it opens the login.aspx page if i type http://localhost/main.aspx it opens the main page without auth and i don't want to
As Abhishek suggested, you need to maintin the session. When users loogs in, store user info in session variable, on every page load check session is null or not, if null , redirect to Login page. You have to clear the session on Log off.
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.