VB Login Page Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dam6

    VB Login Page Problem

    Okay...
    Using vb .net within DW MX2004, connecting to an access database:

    Background: I have created a simple login.aspx page that is supposed to
    re-direct to default.aspx using FormsAuthentica tion.RedirectFr omLoginPage.
    The data is correct from testing the dataset etc and the page also informs
    me that I have entered an incorrect user / password.

    Problem:
    When I go to http://localhost/Modify/Login.aspx and enter the username and
    password the url returns
    http://localhost/Modify/login.aspx?R...2fdefault.aspx and
    does not take me to any other page???

    Code:
    WEB.CONFIG:

    <system.web>
    <customErrors mode="Off" />
    <authenticati on mode = "Forms">
    <forms name = " .SECAUTH " loginUrl="login .aspx">
    <credentials />
    </forms>
    </authentication>
    <authorizatio n>
    <deny users="?" />
    </authorization>
    </system.web>





    LOGIN PAGE:

    <%@ Page Language="VB" ContentType="te xt/html" ResponseEncodin g="iso-8859-1"
    %>
    <%@ Register TagPrefix="MM" Namespace="Drea mweaverCtrls"
    Assembly="Dream weaverCtrls,ver sion=1.0.0.0,pu blicKeyToken=83 6f606ede05d46a, culture=neutral "
    %>
    <MM:DataSet
    id="dsLogin"
    runat="Server"
    IsStoredProcedu re="false"
    ConnectionStrin g='<%#
    System.Configur ation.Configura tionSettings.Ap pSettings("MM_C ONNECTION_STRIN G_connITNoticeb oardASP")
    %>'
    DatabaseType='< %#
    System.Configur ation.Configura tionSettings.Ap pSettings("MM_C ONNECTION_DATAB ASETYPE_connITN oticeboardASP")
    %>'
    CommandText='<% # "SELECT EmployeeID, LastLogin, User_name, Pass_wrd FROM
    tbl_users WHERE User_name = ? AND Pass_wrd = ?" %>'
    Debug="true"[color=blue]
    ><Parameters>[/color]
    <Parameter Name="@User_nam e" Value='<%# IIf((Request.Fo rm("tfUsername" )
    <> Nothing), Request.Form("t fUsername"), "") %>' Type="WChar" />
    <Parameter Name="@Pass_wrd " Value='<%# IIf((Request.Fo rm("tfPasswrd" ) <>
    Nothing), Request.Form("t fPasswrd"), "") %>' Type="WChar" />
    </Parameters></MM:DataSet>
    <MM:PageBind runat="server" PostBackBind="t rue" />
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Login Page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    ..style1 {
    font-size: 18px;
    font-weight: bold;
    }
    -->
    </style>
    </head>
    <body>
    <p align="center" class="style1"> Login Page</p>
    <p>&nbsp;</p>
    <table width="300" border="0" align="center" cellpadding="0"
    cellspacing="0" >
    <tr>
    <td><form runat="server">
    <table width="300" border="0" cellspacing="0" cellpadding="0" >
    <tr>
    <td width="98">User name:</td>
    <td width="202"><as p:TextBox ID="tfUsername " runat="server"
    /></td>
    </tr>
    <tr>
    <td>Password: </td>
    <td><asp:TextBo x ID="tfPasswrd" runat="server" TextMode="Passw ord"
    /></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td><asp:Butt on ID="Button" Text="Login" runat="server" /></td>
    </tr>
    </table>
    </form></td>
    <%
    if dsLogin.RecordC ount > 0 then
    Session("sessUs ername") = Request.Form("t fUsername")
    FormsAuthentica tion.RedirectFr omLoginPage("tf Username.value" , true )
    else if ((Request.Form( "tfUsername "))) <> Nothing OR
    ((Request.Form( "tfPassword "))) <> Nothing
    response.Write( "Login Failed. Please Try Again.")
    end if
    %>


    </tr>
    </table>
    <table width="300" border="0" align="center" cellpadding="0"
    cellspacing="0" >
    <tr>
    <td><p align="center"> <a href="http://www.yahoo.com"
    target="_parent ">www.yahoo.com </a></p>
    <p align="center"> <a href="../search_it.aspx" target="_parent ">Start
    Page</a> </p></td>
    </tr>
    </table>
    <p>&nbsp; </p>
    </body>
    </html>


  • joey.powell@topscene.com

    #2
    Re: VB Login Page Problem

    Is your Default.aspx page secured against anonymous users in
    Web.Config? If so, just hit that page directly...user s will be
    temporarily redirected to the Login.aspx page but then immediately
    returned to Default.aspx upon successfully logging in.

    If Default.aspx is open to anonymous users, you can always include log
    in functionality (user name and password textboxes, log in button with
    code-behind, etc...) directly on that page.

    I am sure there are many other solutions...

    JP>

    Comment

    • Dam6

      #3
      Re: VB Login Page Problem

      Thanks!

      Will give this a go

      <joey.powell@to pscene.com> wrote in message
      news:1119669497 .063984.174530@ f14g2000cwb.goo glegroups.com.. .[color=blue]
      > Is your Default.aspx page secured against anonymous users in
      > Web.Config? If so, just hit that page directly...user s will be
      > temporarily redirected to the Login.aspx page but then immediately
      > returned to Default.aspx upon successfully logging in.
      >
      > If Default.aspx is open to anonymous users, you can always include log
      > in functionality (user name and password textboxes, log in button with
      > code-behind, etc...) directly on that page.
      >
      > I am sure there are many other solutions...
      >
      > JP>
      >[/color]


      Comment

      • Dam6

        #4
        Re: VB Login Page Problem




        Found what was wrong from the books appended mistakes page while looking on
        the web:

        forms name = " SECAUTH " loginUrl="login .aspx">
        not
        forms name = " .SECAUTH " loginUrl="login .aspx">

        take out the full stop and it all works.






        Dam6 wrote:[color=blue]
        > Thanks!
        >
        > Will give this a go
        >
        > <joey.powell@to pscene.com> wrote in message
        > news:1119669497 .063984.174530@ f14g2000cwb.goo glegroups.com.. .[color=green]
        >> Is your Default.aspx page secured against anonymous users in
        >> Web.Config? If so, just hit that page directly...user s will be
        >> temporarily redirected to the Login.aspx page but then immediately
        >> returned to Default.aspx upon successfully logging in.
        >>
        >> If Default.aspx is open to anonymous users, you can always include
        >> log in functionality (user name and password textboxes, log in
        >> button with code-behind, etc...) directly on that page.
        >>
        >> I am sure there are many other solutions...[/color][/color]


        Comment

        Working...