Re: errors running HttpWebRequest.GetResponse - 401 unauthorized



this error was corrected by godaddy providing me with a url of a proxy
server to use on my web requests:

HttpWebResponse resp = null ;
HttpWebRequest rqs = (HttpWebRequest)WebRequest.Create( InURL ) ;
string ProxyUrl = ConfigurationSettings.AppSettings["WebRequestProxy"]
;
if ( ProxyUrl != null )
{
WebProxy proxy = new WebProxy( ProxyUrl ) ;
rqs.Proxy = proxy ;
}
resp = (HttpWebResponse)rqs.GetResponse( ) ;

-Steve



Steve Richter wrote:
> I have a page that uses simple HTTP GET to do an ISBN lookup via
> Amazon.com. The page works when I run it from //localhost. But I
have
> moved it to my godaddy.com shared hoster site, and I get errors on
the
> HttpWebRequest.GetResponse statement.
>
> The remote server returned an error: (401) Unauthorized
>
> also, when I use the network credentials object in the context of my
> request, I get this error:
>
> The underlying connection was closed: The server committed
> an HTTP protocol violation.
>
> Here is the web page I have prepared as I do battle with the godaddy
> techs.
> www.autocoder.com/demosite/AmazonQuery.aspx
>
> click away at it, I dont think any harm can be done.
>
> A code snippet follows. I am working under the assumption that the
> problem resides with the config of the godaddy servers. Is there
> something that has to be enabled in order for my asp.net code to send
a
> web request to another site? Are there magic words I can use to
> convince the godaddy techs to this affect?
>
> thanks,
>
> -Steve
>
> private void WebRequestTest( string InURL )
> {
> string line ;
> StringBuilder sb = new StringBuilder( ) ;
> HttpWebResponse resp ;
> HttpWebRequest rqs = (HttpWebRequest)WebRequest.Create( InURL ) ;
> rqs.MaximumAutomaticRedirections = 4;
> rqs.MaximumResponseHeadersLength = 4;
> // either user default credentials or the credentials specified on
the
> page.
> if ( CheckBox1.Checked == false )
> rqs.Credentials = CredentialCache.DefaultCredentials;
> else
> rqs.Credentials = new NetworkCredential( tbUser.Text,
> tbPassword.Text, tbDomain.Text ) ;
>
> // send the request to the remote site, get the response.
> resp = (HttpWebResponse)rqs.GetResponse( ) ;

.



Relevant Pages

  • Newbie needs a workaround - No Cron Jobs on Godaddy shared server!
    ... Is there already a tool available for poeple with no cron job access? ... I'm on the economy 'shared server' program with Godaddy. ... File Downloader writes the output of the page it downloads, ...
    (comp.lang.php)
  • Re: Production Web Server Setup On Another Server
    ... SBS IP and your MX record points to that A record - right? ... I'm talking here about the DNS at GoDaddy. ... I goes to the correct server and public IP address. ...
    (microsoft.public.windows.server.sbs)
  • Re: Production Web Server Setup On Another Server
    ... It was an MX record issue on GoDaddy. ... SBS IP and your MX record points to that A record - right? ... I goes to the correct server and public IP address. ... 550 destination not valid within DNS ...
    (microsoft.public.windows.server.sbs)
  • Re: Unable to debug ATL out-proc server when the client is ASP page
    ... 'anonymous' web requests. ... When I had two instances of server, one running inside IDE and the ... breakpoint must have hit without me setting 'The interactive user' ... Opened ASP page in IE. ...
    (microsoft.public.vc.language)
  • Re: pythons threading has no "interrupt"?
    ... >>The application I wrote was a web server on the front of an application ... >>so that web requests were all handled in the application. ... Both the server process and the handling processwere at ...
    (comp.lang.python)