Iam having Three Pages(Page1,Page2,Page3) in my application.When ever i run my application Page1loads.After entering the correct usename and password we can access Page2 and Page3.But When ever i copy and paste the url of Page2 and Page3,the pages loads.But i Should not get this,i should aredirect to Page1.
Thank You.
chaitanya vonajaPosted Dec 28, 2008, 1:32 AM
hi,thanks for ur reply regarding url authorization.
I have deployed my application.when i opened the page from iis the page has throw error say ing
Server Error in '/Ajax1' Application.
Cannot open database "chaitanya" requested by the login. The login failed.
Login failed for user 'VK\ASPNET'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Cannot open database "chaitanya" requested by the login. The login failed.
Login failed for user 'VK\ASPNET'.
Plzzzz Help Me
Thanks
Bechir BejaouiPosted Dec 22, 2008, 10:06 AM
first solution:
you can perform an authentication based on user id and password
go to the config file and add this code
solution 2
You can leverage an authentication based on user role, if he/she is admin then he/she enters the protected zone otherwise he/she couldn't as a normal user
in the page 2 and 3 load or init event ad this code
if(page.IsPostBack())
{
if(HttpContext.Current.User.IsInRole("admin"))
{
Server.Transfer( "page.aspx");
}
}