Re: Allowing site Access
- From: "Ken Tucker [MVP]" <vb2ae@xxxxxxxxxxxxx>
- Date: Sun, 17 Apr 2005 13:17:14 -0400
Hi,
Here is some code for the login page. I placed 2 textboxes for
username and passsword and 2 required field validators on the form. The
code is just an example. In a real situation you should store the passwords
encypted. Hope this helps.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnClear.Click
txtUser.Text = ""
txtPassword.Text = ""
End Sub
Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLogin.Click
If Page.IsValid Then
If txtUser.Text = "Mike" And txtPassword.Text = "password" Then
Response.Redirect("Default.aspx")
Else
Response.Write("Invalid User !")
End If
End If
End Sub
Changes that should be made to Web.config
<authentication mode="Forms" >
<forms name="Mypubscookie" loginUrl ="Login.aspx" protection="All"
timeout="30">
</forms>
</authentication>
Ken
----------------
"Glenn T. Kitchen" <KitchenG@xxxxxxxxxxxxx> wrote in message
news:ep7ljxyQFHA.3288@xxxxxxxxxxxxxxxxxxxxxxx
Hi Ken,
Thank you, that does seem to be the correct place. I'm relatively new to
using WebApps and am not able to follow and piece together all the code
needed to do what I'm trying to. If you have the time and patience, could
you please give me the code and where it belongs for my following
information. I spent a lot of time researching this but still couldn't
piece it together.
I have created a webApp with two webForms: 1.) Registration and 2.) Login.
I have both of those working well. I desire to have a user redirected to my
registration webForm (which links straight to Login if applicable for a
user) when they try to access another site. I can combine the application
and the target site, if necessary, into one site. I want to be able to then
redirect the user to the default.htm page of the target site upon completing
login.
I know I have to set configurations in the Web.Config file - section
<Authentication mode="forms"> but am lost about there and beyond. I
apologize for asking such an amount of time from you; I would be greatly
appreciative if you could tell me where and what code I need.
REGISTRATION FORM = webForm1.aspx
LOGIN FORM = webForm2.aspx
TARGET SITE PAGE = default.htm
I have everything to the point that if I could just send a switch saying
that the user is denied or granted access and then redirect them to either a
denial page or the default.htm page I would be set.
Thank you very much for your time!
Glenn T. Kitchen
"Ken Tucker [MVP]" <vb2ae@xxxxxxxxxxxxx> wrote in message
news:OgliC0vQFHA.1884@xxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconthecookieauthenticationprovider.asp
>
> Ken
> ---------------
> "Glenn T. Kitchen" <KitchenG@xxxxxxxxxxxxx> wrote in message
> news:OEGx2ouQFHA.2132@xxxxxxxxxxxxxxxxxxxxxxx
> Hello Group,
>
> I've programmed a registration and login page. I want to allow access to
a
> site only if one is registered. Is there a way to specify a site can only
> be accessed through a specific page (my login form). I can set the site
> privileges of the site through the control panel to non-anonymous but want
> to incorporate my login webForm.
>
> Thank you,
> Glenn
>
>
>
.
- Follow-Ups:
- Re: Allowing site Access
- From: Glenn T. Kitchen
- Re: Allowing site Access
- References:
- Allowing site Access
- From: Glenn T. Kitchen
- Re: Allowing site Access
- From: Ken Tucker [MVP]
- Re: Allowing site Access
- From: Glenn T. Kitchen
- Allowing site Access
- Prev by Date: Locking refresh of winform
- Next by Date: Re: System.UnauthorizedAccessException: When writing XMLSchema
- Previous by thread: Re: Allowing site Access
- Next by thread: Re: Allowing site Access
- Index(es):
Relevant Pages
|