Obtain Network Credentials from Current User in Windows Authentication Application

后端 未结 2 1307
终归单人心
终归单人心 2021-02-05 12:32

I was wondering whether it was possible to obtain the current user object and get their credentials so that I can pass them along to a NetworkCredential object whic

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-05 13:28

    I don't fully understand your question, but is your call coming from ASP.NET that you require the credentials? You could attempt:

    Uri uri = new Uri("http://tempuri.org/");
    ICredentials credentials = CredentialCache.DefaultCredentials;
    NetworkCredential credential = credentials.GetCredential(uri, "Basic");
    

    Assuming your user has already authenticated via a Membership Provider.

提交回复
热议问题