return logged in user name

Discussion in 'ASP .Net' started by Chris Kettenbach, Jul 22, 2005.

  1. Good Morning,
    I have an asp.net app where I want users to be able to update a database. I
    want to automatically pass the logged in persons name to the database as
    well. In a vbscript file I can do this easily. How do I do something
    similar in asp.net. Thanks for any advice.

    '<!-- start .vbs file here -->
    Dim oShell
    Dim UserName

    Set oShell = Wscript.CreateObject("Wscript.Shell")
    UserName = oShell.ExpandEnvironmentStrings("%USERNAME%")

    WScript.Echo UserName
    '<!-- end .vbs file -->

    Regards,
    Chris
    Chris Kettenbach, Jul 22, 2005
    #1
    1. Advertising

  2. Hi Chris,

    Try System.Web.HttpContext.Current.User.Identity.Name


    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Read my weblog:
    Followers of the IHttpHandler
    http://clariusconsulting.net/vga


    "Chris Kettenbach" <> wrote in message
    news:...
    > Good Morning,
    > I have an asp.net app where I want users to be able to update a database.
    > I want to automatically pass the logged in persons name to the database as
    > well. In a vbscript file I can do this easily. How do I do something
    > similar in asp.net. Thanks for any advice.
    >
    > '<!-- start .vbs file here -->
    > Dim oShell
    > Dim UserName
    >
    > Set oShell = Wscript.CreateObject("Wscript.Shell")
    > UserName = oShell.ExpandEnvironmentStrings("%USERNAME%")
    >
    > WScript.Echo UserName
    > '<!-- end .vbs file -->
    >
    > Regards,
    > Chris
    >
    Victor Garcia Aprea [MVP], Jul 22, 2005
    #2
    1. Advertising

  3. Chris Kettenbach

    Siva M Guest

    Page.User.Identity.Name

    "Chris Kettenbach" <> wrote in message
    news:...
    Good Morning,
    I have an asp.net app where I want users to be able to update a database. I
    want to automatically pass the logged in persons name to the database as
    well. In a vbscript file I can do this easily. How do I do something
    similar in asp.net. Thanks for any advice.

    '<!-- start .vbs file here -->
    Dim oShell
    Dim UserName

    Set oShell = Wscript.CreateObject("Wscript.Shell")
    UserName = oShell.ExpandEnvironmentStrings("%USERNAME%")

    WScript.Echo UserName
    '<!-- end .vbs file -->

    Regards,
    Chris
    Siva M, Jul 22, 2005
    #3
  4. This might only work if the site is not setup for anonymous users.

    "Victor Garcia Aprea [MVP]" <> wrote in message
    news:...
    > Hi Chris,
    >
    > Try System.Web.HttpContext.Current.User.Identity.Name
    >
    >
    > --
    > Victor Garcia Aprea
    > Microsoft MVP | ASP.NET
    > Read my weblog:
    > Followers of the IHttpHandler
    > http://clariusconsulting.net/vga
    >
    >
    > "Chris Kettenbach" <> wrote in message
    > news:...
    > > Good Morning,
    > > I have an asp.net app where I want users to be able to update a

    database.
    > > I want to automatically pass the logged in persons name to the database

    as
    > > well. In a vbscript file I can do this easily. How do I do something
    > > similar in asp.net. Thanks for any advice.
    > >
    > > '<!-- start .vbs file here -->
    > > Dim oShell
    > > Dim UserName
    > >
    > > Set oShell = Wscript.CreateObject("Wscript.Shell")
    > > UserName = oShell.ExpandEnvironmentStrings("%USERNAME%")
    > >
    > > WScript.Echo UserName
    > > '<!-- end .vbs file -->
    > >
    > > Regards,
    > > Chris
    > >

    >
    >
    Peter Rilling, Jul 22, 2005
    #4
    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. Ganesh Ramamurthy

    Getting Logged in User Name

    Ganesh Ramamurthy, Dec 8, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    1,911
    Patrick Olurotimi Ige
    Dec 8, 2004
  2. keithb
    Replies:
    0
    Views:
    621
    keithb
    Feb 16, 2006
  3. Replies:
    1
    Views:
    933
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Apr 12, 2007
  4. Imran Aziz

    Get the current logged in user name

    Imran Aziz, Aug 2, 2005, in forum: ASP .Net Security
    Replies:
    8
    Views:
    196
  5. Learner
    Replies:
    0
    Views:
    121
    Learner
    Mar 7, 2006
Loading...

Share This Page