•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 422,921 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,376 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 230 | Replies: 1 | Solved
![]() |
•
•
Join Date: Sep 2006
Posts: 104
Reputation:
Rep Power: 3
Solved Threads: 0
I have a login page where I have my own label and texboxes which take input username and password, and there is a function in which there is a SP which validates username and password stored in the database.
My code in Login.aspx.cs is such that I call that function and validates username and password and redirects to next page Page2.aspx.
Now I want my site to be authorized such that if a user tries to access internal pages he couldn't be able to do that.
I have code in my WEb.config for that is
and code in login.aspx.cs is
Now when I try to run internal pages without login it automatically redirects to login page which is fine but when I put valid username and password in the login page it redirects with some "ReturnUrl" and not able to redirect to the Page2.aspx page.This is my problem.
Can anybody tell me where I am doing wrong or need to change the code somewhere?
Thanks in advance,
My code in Login.aspx.cs is such that I call that function and validates username and password and redirects to next page Page2.aspx.
Now I want my site to be authorized such that if a user tries to access internal pages he couldn't be able to do that.
I have code in my WEb.config for that is
<authentication mode="Forms"> <forms cookieless="UseCookies" timeout="525600" /> </authentication> <authorization> <deny users="?" /> <allow users="*" /> </authorization>
and code in login.aspx.cs is
protected void btnLogin_Click(object sender, EventArgs e)
{
validateUser = validateUser.ValidateUser(txtUserName.Text, hashedPassword);
if (Page.IsValid)
{
if (validateUser != null)
{
Response.Redirect("~/Page2.aspx");
}
else
{
lblErrorMessage.Text = "Invalid User";
}
}
}Can anybody tell me where I am doing wrong or need to change the code somewhere?
Thanks in advance,
![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Previous Thread: code for save dialog box
- Next Thread: ScrollBar


Linear Mode