473,396 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Grabbing content w/ a WebRequest from an Whidbey Forms Based Auth

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!
Nov 19 '05 #1
0 1095

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jacob | last post by:
Hello All, I am trying to serve out some content via IIS that is hosted on a remote fileserver, and am unable to get the delegation working correctly. Our setup is as follows: Local LAN...
5
by: Dan Smith | last post by:
Right now the only way to use a WinForms control in MFC is to enable COM Interop for the control and use it in MFC as you would any ActiveX control. While this works, COM Interop is a pain, and an...
4
by: 23s | last post by:
I had this problem in the past, after a server reformat it went away, and now after another server reformat it's back again - no clue what's doing it. Here's the flow: Website root is public, no...
3
by: | last post by:
One thing I did a lot of in Classic ASP involved showing page elements conditionally based on whether a user was logged in or not. Logged in users or "superusers" would get more content and/or more...
2
by: code | last post by:
Hi, I have stumbled across an interesting problem regarding forms authentication over multiple sub domains. The topic has been covered in various forms online but never really gets a definitive...
5
by: rogsonl | last post by:
My computer was moved last week, and the company changed the network groups we work on. As a result, one of the main benefits from Whidbey (database connectivity) no longer works. Situation: 1....
2
by: kkb | last post by:
Hello! First, I'm sorry because of my english... I'll try to be understandable! I've got a strange problem using .NET 2003 C# and I haven't figured it out for a long time. I'm implementing an...
4
by: rony_16 | last post by:
Hi, I have a program that connects to a site With WebRequest and WebResponse . The response of this site is a file (csv file). The problem is that the file do not comes as a stream , hi is a part...
0
by: tagg3rx | last post by:
Hi All, I'm trying to get forms based auth up and working and I'm running into a little snag. My login page needs to access css files and images in my application and when I enable the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.