Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default help me !!!

    people, i have this code in my web.confi

    <location path="admin">
    <system.web>
    <authorization>
    <deny users="*" />
    <allow users="administrador" />
    </authorization>
    </system.web>
    </location>


    how can i created this user "administrador" in my formsAuthentication ??

    I need help....

    Tks





    Alexandre Martins Guest

  2. #2

    Default Re: help me !!!

    How about something like this... this would be code in your login click
    method...

    Dim objFormsAuthentication As System.Web.Security.FormsAuthentication
    Dim objSec As New MyClassLibrary.Security()
    Dim lngUserId As Long

    '--- Using Security component authenticate user
    lngUserId = objSec.CheckUser(txtUserName.Value,
    txtUserPass.Value, MyClassLibrary.Security.WebUserType.enEmployee,
    Application.Item("Connection"))
    '--- If user id is positive then login user else set the message
    If lngUserId > 0 Then
    Session("UserId") = lngUserId
    objFormsAuthentication.RedirectFromLoginPage _
    (lngUserId, False)
    Else
    Select Case lngUserId
    Case -1, -2
    lblMsg.Text = "Invalid Credentials: Please try
    again"
    Case -3
    lblMsg.Text = "Account is locked: Please contact
    administrator"
    Case -4
    lblMsg.Text = "Account is inactive: Please contact
    administrator"
    End Select

    End If



    hth



    "Alexandre Martins" <master@alexandrem.com.br> wrote in message
    news:e6r66neXDHA.2484@TK2MSFTNGP09.phx.gbl...
    > people, i have this code in my web.confi
    >
    > <location path="admin">
    > <system.web>
    > <authorization>
    > <deny users="*" />
    > <allow users="administrador" />
    > </authorization>
    > </system.web>
    > </location>
    >
    >
    > how can i created this user "administrador" in my formsAuthentication ??
    >
    > I need help....
    >
    > Tks
    >
    >
    >
    >
    >

    alien2_51 Guest

  3. #3

    Default RE: help me !!!

    Try this page, it seems to have some good sample code:

    [url]http://www.xoc.net/works/tips/forms-authentication.asp[/url]

    --

    This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
    [url]http://www.microsoft.com/info/cpyright.htm[/url]

    Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated.
    --------------------
    >From: "Alexandre Martins" <master@alexandrem.com.br>
    >Subject: help me !!!
    >Date: Fri, 8 Aug 2003 17:17:41 -0300
    >Lines: 22
    >X-Priority: 3
    >X-MSMail-Priority: Normal
    >X-Newsreader: Microsoft Outlook Express 6.00.2720.3000
    >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300
    >Message-ID: <e6r66neXDHA.2484@TK2MSFTNGP09.phx.gbl>
    >Newsgroups: microsoft.public.dotnet.framework.aspnet
    >NNTP-Posting-Host: 200-168-24-105.speedyterra.com.br 200.168.24.105
    >Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
    >Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:166276
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    >
    >people, i have this code in my web.confi
    >
    ><location path="admin">
    ><system.web>
    ><authorization>
    ><deny users="*" />
    ><allow users="administrador" />
    ></authorization>
    ></system.web>
    ></location>
    >
    >
    >how can i created this user "administrador" in my formsAuthentication ??
    >
    >I need help....
    >
    >Tks
    >
    >
    >
    >
    >
    >

    Alexander Davidov [MSFT] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139