Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to make WebRequest from ASP without accessing registry for pro

Thread Tools

How to make WebRequest from ASP without accessing registry for pro

Posts: n/a
Hi Everyone,

I have a .NET dll that uses the HTTPWebRequest class to make an HTTP
connection to an off-site server. This dll works just fine from a Winform but
when I try to use it from an ASP page (via COM Interop) and get a registry
access exception. I know why this happening. The dll makes the request using
the following:

request = CType(WebRequest.Create(url), HttpWebRequest)

When the dll is being instanciated from an ASP page the ASP process attemps
to read the registry in order to obtain the default proxy value set in
Internet Explorer. Unfourtunetly the ASP process does not have the
permissions to do this, hence the exception being thrown.

I can get around this by changing the <proxy "usesystemdefault=true"> node
of the machine.config to "false". This prevents the dll from even looking for
proxy information. However, since the default value in the machine.config is
"true" I would like to find a solution in the code to prevent checking for a
proxy. This way I do not have to alter the machine.config on the web servers
I deploy to.

I have tried using the following to tell the WebRequest that I do not need
to check for a proxy:

request = CType(WebRequest.Create(url), HttpWebRequest)
request.Proxy = GlobalProxySelection.GetEmptyWebProxy()

However, this does not seem to work because the exception is being thrown on
the first line when I attempt to create the WebRequest.

Any suggestions that someone might have would be appreciated. I have been
combing the web via Google to find and answer but to no avail. Thanks again!

- Dwek
Reply With Quote
Steven Cheng[MSFT]
Posts: n/a
Hi Dwek,

Thanks for your posting. As for this problem, I've posted my reply in
another former thread of yours:

Subject: Re: HTTPWebResponse: Winform = Pass; ASP DLL = Fail

in this group. I'd appreciate if you have a look there. If there're any
further questions, please feel free to post in either thread. Thanks.


Steven Cheng
Microsoft Online Support

Get Secure!
(This posting is provided "AS IS", with no warranties, and confers no

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to read a registry key from Windows registry ? Leny Java 3 02-01-2005 07:54 AM
Interpretation of registry log of tweakui produced registry alteration ASP .Net 0 01-10-2005 02:53 AM
Reading registry key throws "Requested registry access is not allowed." HK ASP .Net 1 04-01-2004 04:44 PM
WebRequest - download files from directory without knowing name of file CodeMotion ASP .Net 0 07-03-2003 09:59 PM