Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Navigation Question...

Status
Not open for further replies.

RichS

Programmer
Apr 24, 2000
380
US
I am new to ASP.NET.

I have a function that validates a user. If it succeeds it want to go to a different page. Can I do this in the code behind file? If not what is the best way to take a user to another page based on a condition?


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' If this is a Postback check the credentials against the db
If Page.IsPostBack Then
If funValidateUser() > 0 Then
Consultant.UserName = txtUserName.Text
' Here I want to redirect...
'Response.Redirect("TopicList.aspx")
Else
lblMessage.Text = "The credentials entered where invalid."
End If
End If
End Sub
 
' Here I want to redirect...
'Response.Redirect("TopicList.aspx")

Just take the comment off of your response.redirect.

I would suggest that you check into the built in form validation. It provides a much smoother way to validate your users. Just go into your help and look up Forms Authentication, the Simple Forms Authentication article provides an excellent example to follow. Other places to look for tutorials are and That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Oops, I meant to uncomment that before I submitted the post. It seems the actual error was how I was addressing the label control.

Thanks for the validation info.
 
My oops! Just so that I make sure I didn't confuzzle you I meant to say Authentication not validation. The word validation is generally with regard to checking the data on the form not for user log ins

Your welcome That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top