Re: errors running HttpWebRequest.GetResponse - 401 unauthorized
- From: "Steve Richter" <StephenRichter@xxxxxxxxx>
- Date: 29 Apr 2005 17:30:42 -0700
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( ) ;
.
- Follow-Ups:
- Re: errors running HttpWebRequest.GetResponse - 401 unauthorized
- From: Shane Thomas
- Re: errors running HttpWebRequest.GetResponse - 401 unauthorized
- References:
- errors running HttpWebRequest.GetResponse - 401 unauthorized
- From: Steve Richter
- errors running HttpWebRequest.GetResponse - 401 unauthorized
- Prev by Date: Re: Common Web functions dll (Used to use MTS, what do I use in .NET
- Next by Date: Re: Session URL Formatting
- Previous by thread: errors running HttpWebRequest.GetResponse - 401 unauthorized
- Next by thread: Re: errors running HttpWebRequest.GetResponse - 401 unauthorized
- Index(es):
Relevant Pages
|