Re: Allowing site Access

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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
>
>
>



.



Relevant Pages

  • RE: Help! Access 2007 Login form problem
    ... Now the login form is generating the following error if you don't tab ... Private Sub Auto_Title0_Click ... 'If User enters incorrct password 3 times the database will shut down ...
    (microsoft.public.access.forms)
  • Forms Authentication Security questions...
    ... Login page, in you case default.aspx. ... string ReturnUrl=/admin/admin.aspx for late return. ... >Imports Microsoft.VisualBasic ... > Private Sub Page_Load(sender as Object, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: RedirectFromLoginPage
    ... Much appreciated Greg. ... > redirects you to page of choice after logging in. ... > If you do login succesfully, then attempt to go to page your are not ... > Private Sub Page_Load(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Problem with web.config access-restricted subdirectory
    ... the login page when you acces the /Parent/Child/Default.aspx page. ... 'This call is required by the Web Form Designer. ... Private Sub Page_Init(ByVal sender As System.Object, ... the redirect still brings me back to ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Allowing site Access
    ... and the Login page. ... > Private Sub btnClear_Click(ByVal sender As System.Object, ... > and the target site, if necessary, into one site. ... >> be accessed through a specific page (my login form). ...
    (microsoft.public.dotnet.languages.vb)