Hi all--
I'm retrieving contents from my site using the retrieving images from the
database method listed here:
http://www.aspfree.com/c/a/ASP.NET/R...--C---Part-II/
Basically, the page just returns the image into the page (also within the
same site) that's calling it.
However, because the entire site is under my Forms based auth (using
Whidbey), every time I try and request it, either directly in the web page,
or through a WebRequest, the site responds requiring authentication. I've
tried to do any of the following:
Impersonate the user requesting the image (since you already had to auth in
order to get to the site)
<code>
UriBuilder newURB = new UriBuilder("http://localhost:" + portNum +
Image1.ImageUrl);
WebRequest webReq = HttpWebRequest.Create(newURB.Uri);
webReq.ImpersonationLevel =
System.Security.Principal.TokenImpersonationLevel. Impersonation;
WebResponse webResponse = webReq.GetResponse();
</code>
Create a user and pass combo and building a webrequest
<code>
UriBuilder newURB = new UriBuilder("http://localhost:" + portNum +
Image1.ImageUrl);
newURB.UserName = "me";
newURB.Password = "12345";
WebRequest webReq = HttpWebRequest.Create(newURB.Uri);
WebResponse webResponse = webReq.GetResponse();
</code>
Turning off authentication to that page and directory:
<code>
<location path="mydir/e/">
<system.web>
<authorization>
<allow users="?" />
<allow users="*" />
</authorization>
</system.web>
</location>
</code>
I've read up and see there's a way to do it by getting the view state, but
that means every request for this image takes two requests... there's got to
be a better way! Thanks in advance!