471,337 Members | 1,167 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Why "(500) Internal Server Error" throwed?

Hi,

When I am using the fowllowing code to open page
http://spaces.msn.com/members/mailcall/
....
try{
string url = http://spaces.msn.com/members/mailcall/;
HttpWebRequest httpReq = null;
HttpWebResponse httpResp = null;
httpReq = (HttpWebRequest)WebRequest.Create(url);
httpResp = (HttpWebResponse) httpReq.GetResponse();
}
catch(WebException ex)
{
....
}
....
I always got an WebException which says "The remote server returned an
error: (500) Internal Server Error". But actually if you open that page in
IE, it can be opened without any problem. How can I open this page in my
program and get the html source?

Any help would appreciate!

Andy
Feb 22 '06 #1
2 7111
When I go to that address, IE redirects me to
http://spaces.msn.com/mailcall/. Have you tried connecting to that address
rather than the one you have been?

"Andy Chen" <pp****@hotmail.com> wrote in message
news:ei**************@TK2MSFTNGP14.phx.gbl...
Hi,

When I am using the fowllowing code to open page
http://spaces.msn.com/members/mailcall/
...
try{
string url = http://spaces.msn.com/members/mailcall/;
HttpWebRequest httpReq = null;
HttpWebResponse httpResp = null;
httpReq = (HttpWebRequest)WebRequest.Create(url);
httpResp = (HttpWebResponse) httpReq.GetResponse();
}
catch(WebException ex)
{
...
}
...
I always got an WebException which says "The remote server returned an
error: (500) Internal Server Error". But actually if you open that page in
IE, it can be opened without any problem. How can I open this page in my
program and get the html source?

Any help would appreciate!

Andy

Feb 22 '06 #2
Thus wrote Andy,
Hi,

When I am using the fowllowing code to open page
http://spaces.msn.com/members/mailcall/
...
try{
string url = http://spaces.msn.com/members/mailcall/;
HttpWebRequest httpReq = null;
HttpWebResponse httpResp = null;
httpReq = (HttpWebRequest)WebRequest.Create(url);
httpResp = (HttpWebResponse) httpReq.GetResponse();
}
catch(WebException ex)
{
...
}
...
I always got an WebException which says "The remote server returned an
error: (500) Internal Server Error". But actually if you open that
page in
IE, it can be opened without any problem. How can I open this page in
my
program and get the html source?
Any help would appreciate!


You don't send any HTTP header on which spaces.msn.com may rely on, like
User-Agent or Accept-Language. Try to send the same HTTP headers like a browser
(e.g. IE6) does. You can use tools like Fiddler to capture the HTTP traffic.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Feb 22 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by David Sworder | last post: by
1 post views Thread by phranque | last post: by
2 posts views Thread by Sosa | last post: by
reply views Thread by rosydwin | last post: by

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.