Newbie question

L

lsumnler

I have written or I should say walked through (copied) the one training
session on the Webmatrix dealing with the creation of a login.aspx.
This is working great. Once the login has been accepted it automaticly
brings up the default.aspx.

My questions are as follows:

1. If I want this to bring up a aspx file other than default when the
Login button is pressed how would I do that. Following is the code
from the example;

Sub LoginBtn_Click(Sender As Object, E As EventArgs)

If Page.IsValid Then
Dim userDS As New System.Data.DataSet

userDS = GetUser(UserName.Text, UserPass.Text)

If userDS.Tables(0).Rows.Count = 1 Then
FormsAuthentication.RedirectFromLoginPage(UserName.Text,
true)
Else
Msg.Text = "Invalid Credentials: Please try again"
End If
End If

2. The aspx file I need to call is also a login type screen. The
login and password is the same for everyone. So what I would like to
do is from my login screen, provided it is valid, to call this other
login screen passing in the common user and password and not actually
display but take the user then into the system.

Thanks
Len Sumnler
 
G

Guest

Hi

1.
The way the ASP.NET authentication works is that whatever page you call
first it checks if you are authenticated. If you are not it then sends you to
the login page once you login it will then send you back to the first page
you called.
In your casse you are actually going to the default page first then being
redirected to the login page and back to default once you login.
To get a different page to come up simply navigate to that page first or set
the other page as your default page in IIS (I'm not sure if the web server
that comes with asp.net has this functionality)

2.
Unless you need two different logins one auto and one where the user must
supplly credentials I'd do the following

just have the following in your login page's load event

FormsAuthentication.RedirectFromLoginPage("YourUserName",true)

you should need nothing else on the page no controls etc
Although this does beg the question why have security in the first place

Are the two login pages on different domains?

Hope this helps somewhat

Felix
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top