Total Beginner Question.

Discussion in 'ASP General' started by INTP56, Feb 3, 2009.

  1. INTP56

    INTP56 Guest

    I have a need to get the current logged on user and pass that value on to a
    database. WHile ASP:LoginName displays the right value, I can't seem to
    figure out how to use that value anywhere else. I've included some very basic
    code, and I'm wondering if someone can show me how to get the login name into
    a text box. I have figured out how to use a value in a textbox as a parameter
    (If I just set it to a valid value).

    TIA, Bob

    Here is some code I've tried.

    <%@ Page Language="C#" %>
    <html dir="ltr">

    <head runat="server">
    <META name="WebPartPageExpansion" content="full">
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Untitled 1</title>
    </head>

    <body>

    <form id="form1" runat="server">
    LoginControl:
    <asp:LoginName
    runat="server"
    id="LoginName1"/>
    <br>
    <br>
    TextBox:
    <asp:TextBox
    runat="server"
    id="TextBox1"
    text="What do I put here to get the value of LoginName1?"
    Width="378px">
    </asp:TextBox>
    <br>
    TestBox1:
    <asp:TextBox
    runat="server"
    id="TestBox1"
    text=Request.ServerVariables("LOGON_USER")
    Width="378px">
    </asp:TextBox>
    <br>
    TestBox2:
    <asp:TextBox
    runat="server"
    id="TestBox2"
    text=User.Identity.Name
    Width="378px">
    </asp:TextBox>
    <br>
    TestBox3:
    <asp:TextBox
    runat="server"
    id="TestBox3"
    text=HttpContext.Current.User.Identity.Name
    Width="378px">
    </asp:TextBox>
    <br>
    TestBox4:
    <asp:TextBox
    runat="server"
    id="TestBox4"
    text='<%Session("Username")%>'
    Width="378px">
    </asp:TextBox>
    <br>
    </form>

    </body>

    </html>
    INTP56, Feb 3, 2009
    #1
    1. Advertising

  2. INTP56

    Evertjan. Guest

    =?Utf-8?B?SU5UUDU2?= wrote on 03 feb 2009 in
    microsoft.public.inetserver.asp.general:

    > I have a need to get the current logged on user and pass that value on
    > to a database. WHile ASP:LoginName displays the right va


    This is a classic asp group.

    Dotnet questions should be asked in
    <microsoft.public.dotnet.framework.aspnet>

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Feb 3, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?=

    No Class at ALL!!! beginner/beginner question

    =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?=, Feb 2, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    557
    =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?=
    Feb 3, 2005
  2. sarmin
    Replies:
    1
    Views:
    299
    BW Glitch
    Dec 4, 2003
  3. INTP56

    Total Beginner Question

    INTP56, Feb 3, 2009, in forum: ASP .Net
    Replies:
    7
    Views:
    458
    Alexey Smirnov
    Feb 5, 2009
  4. cros
    Replies:
    1
    Views:
    91
    Matthew Smillie
    Dec 8, 2005
  5. Replies:
    11
    Views:
    192
    Phil Connell
    May 28, 2013
Loading...

Share This Page