6

I have page A.aspx in my domain

this page (in its c# codes) makes a request to another page.(B.aspx). - which is in my domain also

the whole site is in windows authentication

HttpWebRequest loHttp = (HttpWebRequest)WebRequest.Create("http://mydom.com/b.aspx");
loHttp.UseDefaultCredentials = true;
loHttp.Timeout = 100000;
HttpWebResponse loWebResponse = (HttpWebResponse)loHttp.GetResponse();
Encoding enc = Encoding.GetEncoding("UTF-8");  // Windows default Code Page
StreamReader loResponseStream = new StreamReader(loWebResponse.GetResponseStream(), enc);
string lcHtml = loResponseStream.ReadToEnd();
loWebResponse.Close();
loResponseStream.Close();
return lcHtml;

Im using impersonation in my web site to a specific account.

the account is being transferred by the statement :

 loHttp.UseDefaultCredentials = true;

all is fine.....

However, I want to see those credentials ( I need their "get")

I know that the current thread account(being affected by impersonation)is given by :

WindowsIdentity.GetCurrent().Name

but I want to see the values that in the UseDefaultCredentials ! something like

DefaultCredentials.getCurrent.username
DefaultCredentials.getCurrent.password...

how can I do that ?

Abdul Munim
  • 18,869
  • 8
  • 52
  • 61
Royi Namir
  • 144,742
  • 138
  • 468
  • 792

1 Answers1

9

I had to do this but in WinForms. It might be work for you too:

System.Net.CredentialCache.DefaultNetworkCredentials

or

System.Net.CredentialCache.DefaultCredentials
SuperOli
  • 1,784
  • 1
  • 11
  • 23