Ask a Question related to ASP.NET Security, Design and Development.
-
Jamie #1
HttpWebRequest, impersonation and DefaultCredentials problem.
I'm trying to create a HttpWebRequest object that uses the current logged in
user's credentials.
It's currently setup with:
<identity impersonate="true" /> in web.config
IIS - Windows Authentication
IIS - Anonymous access disabled
making the request like this:
HttpWebRequest webrequest =
(HttpWebRequest)WebRequest.Create("http://myserver/site/page.aspx);
webrequest.Credentials = CredentialCache.DefaultCredentials;
HttpWebResponse webresponse = (HttpWebResponse)webrequest.GetResponse();
I've verified that impersonate is working correctly on the aspx page by
printing out:
System.Security.Principal.WindowsIdentity.GetCurre nt().Name.ToString();
It's also using windows authentication properly, i've verified that by
printing out: Page.User.Identity.Name.ToString();
It only seems to work when I browse to the page from the same system as the
webserver. When i go to another system
and browse to the web page i get a (401) unauthorized error message.
Any ideas?
Jamie Guest
-
DefaultCredentials problem?
Hi All, this is the scenario: - "Hello World" web service on Machine A - winform client on Machine B - asp.net webform client on Machine B ... -
Problem using HttpWebRequest/HttpWebResponse with HTTPS
Did you ever solve this problem? If so, please can you let me know how as I am trying to do something similar. richard.beacroft@warnerbros.com ... -
HTTPWebRequest + Cookies problem
Hi, In continue to another post which I have in this news group, I was able to find out some more details about the problem What is my... -
HttpWebRequest Session Length Problem
I need to send multiple WebRequests in the same session. The problem is I send the first request, which is a login request, receive the reply that... -
ASP.NET Impersonation, XmlUrlResolver, and DefaultCredentials
I'm trying to write an ASP.NET page that does on-the-fly XML/XSL transformation. The code is as follows: --- Dim xmlPath As String =... -
Kevin C #2
Re: HttpWebRequest, impersonation and DefaultCredentials problem.
This is a very common pitfall.
Here are a couple links.
[url]http://support.microsoft.com/default.aspx?scid=kb;en-us;810572[/url] (there are
more at the bottom of this linked article too)
[url]http://blogs.geekdojo.net/justin/archive/2003/12/10/430.aspx[/url] .
Long story short, unless you plan to deploy AD or already running (but
obviously not configured for delegation) you will need to come up with a
different means of propagating the credentials.
Kevin Cunningham
"Jamie" <spammerssuck@nospam.com> wrote in message
news:uIWgmLHAEHA.2308@tk2msftngp13.phx.gbl...in> I'm trying to create a HttpWebRequest object that uses the current loggedthe> user's credentials.
>
> It's currently setup with:
> <identity impersonate="true" /> in web.config
> IIS - Windows Authentication
> IIS - Anonymous access disabled
>
> making the request like this:
> HttpWebRequest webrequest =
> (HttpWebRequest)WebRequest.Create("http://myserver/site/page.aspx);
> webrequest.Credentials = CredentialCache.DefaultCredentials;
> HttpWebResponse webresponse = (HttpWebResponse)webrequest.GetResponse();
>
>
> I've verified that impersonate is working correctly on the aspx page by
> printing out:
> System.Security.Principal.WindowsIdentity.GetCurre nt().Name.ToString();
>
> It's also using windows authentication properly, i've verified that by
> printing out: Page.User.Identity.Name.ToString();
>
> It only seems to work when I browse to the page from the same system as> webserver. When i go to another system
> and browse to the web page i get a (401) unauthorized error message.
>
> Any ideas?
>
>
Kevin C Guest



Reply With Quote

