User Name Password Register
DaniWeb IT Discussion Community
All
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 426,364 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 2,462 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

ASP.Net Security 101 Part 1

Join Date: Apr 2006
Posts: 1
Reputation: mak101 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mak101 mak101 is offline Offline
Newbie Poster

Re: ASP.Net Security 101 Part 1

  #6  
Apr 3rd, 2006
Works like charm, only problem is, it doesnt redirect to original calling page. It always redirects to default.aspx.

Here is my code:

[PHP]Protected Sub cmdSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdSubmit.Click
If Page.IsValid Then ' ||||| Meaning the Control Validation was successful!
' ||||| Connect to Database for User Validation |||||
If Login(txtUserName.Text.Trim(), txtPassword.Text.Trim()) Then
Session("Logged_IN") = "Yes" ' ||||| Use to Validate on other pages in the application
FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, False) ' ||||| default.aspx Page!
Else
' ||||| Credentials are Invalid
lblMessage.Text = "Invalid Login!"
End If
End If
End Sub[/PHP]
Here is my code in page_load event which I need to secure:

[PHP]If Session("Logged_IN").Equals("No") Then
Response.Redirect("Login.aspx")
End If[/PHP]

What am I missing here?
Reply With Quote  
All times are GMT -4. The time now is 12:18 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC