How to make WebRequest from ASP without accessing registry for pro

Discussion in 'ASP .Net' started by =?Utf-8?B?RFdyZWs=?=, Dec 2, 2004.

  1. 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
     
    =?Utf-8?B?RFdyZWs=?=, Dec 2, 2004
    #1
    1. Advertising

  2. 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.

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    Steven Cheng[MSFT], Dec 3, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. HK
    Replies:
    1
    Views:
    3,714
    Cowboy \(Gregory A. Beamer\)
    Apr 1, 2004
  2. Replies:
    0
    Views:
    781
  3. Leny
    Replies:
    3
    Views:
    16,984
    Daniel
    Feb 1, 2005
  4. Replies:
    0
    Views:
    269
  5. Wayne Erfling
    Replies:
    0
    Views:
    365
    Wayne Erfling
    Nov 18, 2006
Loading...

Share This Page