Is it possible to get a NetworkCredential object from the current

Discussion in 'ASP .Net' started by =?Utf-8?B?WUs=?=, Jul 4, 2006.

  1. Hi

    I have a Web Application that connects to Exchange WebDAV using a class that
    I found on http://www.codeproject.com/dotnet/exdav.asp.
    This class requires a NetworkCredential object in order to authenticate the
    HTTP request against the Exchange server, and since that my WebApp is
    configured in the IIS to use ONLY Integrated Windows Authentication I have
    the Windows identity object from which I can get only the user name.

    Is there a way to get a NetworkCredential object of the current user that is
    connected to this web page?

    I tried to impersonate the current user and use DefaultCredentials property
    but it returned null. I get the same problem when I connect to webservices
    that I created from other web applications.

    Thanks in advance,

    Yuval
    =?Utf-8?B?WUs=?=, Jul 4, 2006
    #1
    1. Advertising

  2. if you are using Exchange, you probably already have the username and
    password of the user
    from theire login to the machine or your webApplication...

    just use that

    Private mailCredentials As New Net.NetworkCredential("USERNAME", "PWD")


    --

    Bruno Alexandre
    (a Portuguese in Københanv, Danmark)


    "YK" <> escreveu na mensagem
    news:...
    > Hi
    >
    > I have a Web Application that connects to Exchange WebDAV using a class
    > that
    > I found on http://www.codeproject.com/dotnet/exdav.asp.
    > This class requires a NetworkCredential object in order to authenticate
    > the
    > HTTP request against the Exchange server, and since that my WebApp is
    > configured in the IIS to use ONLY Integrated Windows Authentication I have
    > the Windows identity object from which I can get only the user name.
    >
    > Is there a way to get a NetworkCredential object of the current user that
    > is
    > connected to this web page?
    >
    > I tried to impersonate the current user and use DefaultCredentials
    > property
    > but it returned null. I get the same problem when I connect to webservices
    > that I created from other web applications.
    >
    > Thanks in advance,
    >
    > Yuval
    Bruno Alexandre, Jul 4, 2006
    #2
    1. Advertising

  3. Re: Is it possible to get a NetworkCredential object from the curr

    Well, not exactly... I can access the username using
    System.Security.Principal.WindowsIdentity.GetCurrent().Name but I can't get
    the user's password or domain...

    If I try to use System.Net.CredentialCache.DefaultCredentials it returns null.

    Any ideas??

    "Bruno Alexandre" wrote:

    > if you are using Exchange, you probably already have the username and
    > password of the user
    > from theire login to the machine or your webApplication...
    >
    > just use that
    >
    > Private mailCredentials As New Net.NetworkCredential("USERNAME", "PWD")
    >
    >
    > --
    >
    > Bruno Alexandre
    > (a Portuguese in Københanv, Danmark)
    >
    >
    > "YK" <> escreveu na mensagem
    > news:...
    > > Hi
    > >
    > > I have a Web Application that connects to Exchange WebDAV using a class
    > > that
    > > I found on http://www.codeproject.com/dotnet/exdav.asp.
    > > This class requires a NetworkCredential object in order to authenticate
    > > the
    > > HTTP request against the Exchange server, and since that my WebApp is
    > > configured in the IIS to use ONLY Integrated Windows Authentication I have
    > > the Windows identity object from which I can get only the user name.
    > >
    > > Is there a way to get a NetworkCredential object of the current user that
    > > is
    > > connected to this web page?
    > >
    > > I tried to impersonate the current user and use DefaultCredentials
    > > property
    > > but it returned null. I get the same problem when I connect to webservices
    > > that I created from other web applications.
    > >
    > > Thanks in advance,
    > >
    > > Yuval

    >
    >
    >
    =?Utf-8?B?WUs=?=, Jul 4, 2006
    #3
  4. =?Utf-8?B?WUs=?=

    *Busy*

    Joined:
    Mar 24, 2010
    Messages:
    1
    WindowsIdentity to NetworkCredential

    I've asked this question here: forums.asp.net/p/1539142/3747362.aspx#3747362
    I, like you, am still waiting to hear if this can be done.

    Also, if you print out the user name of the windows identity (or view the value in the debugger), you'll notice that if the page visitor is on a domain, it will be included in the username as "<domain>\<username>" and you can parse out the domain if necessary.
    *Busy*, Mar 24, 2010
    #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. Jay Douglas
    Replies:
    4
    Views:
    716
    Jay Douglas
    Mar 6, 2004
  2. IveCal

    NetworkCredential

    IveCal, Apr 17, 2006, in forum: Java
    Replies:
    6
    Views:
    4,268
    Oliver Wong
    Apr 20, 2006
  3. Replies:
    3
    Views:
    1,359
  4. wgo
    Replies:
    0
    Views:
    183
  5. Replies:
    1
    Views:
    287
    Thomas 'PointedEars' Lahn
    Mar 19, 2008
Loading...

Share This Page