Archive
Passing foreign charachters in a URL
System.Web.HttpUtility.UrlEncodeUnicode(result).Replace("u00","");
Getting more out of your 500 Internal Server Error
When you make a request from .NET to a remote page, and that page crashes with a 500 error. the exception thrown doesn’t normally tell you anything more than a 500 server error has occurred. You can get the exact html from the page using this:
try
{
httpresponse = (HttpWebResponse)httprequest.GetResponse();
}
catch(Exception e)
{
if(e is WebException)
{
WebException wexError = (WebException)e;
if(wexError.Status == WebExceptionStatus.ProtocolError)
{
WebResponse wrError = wexError.Response;
Stream stmError = wrError.GetResponseStream();
StreamReader srError= new StreamReader(stmError);
string strError = srError.ReadToEnd();
System.Diagnostics.Debug.Write(strError);
throw(e);
}
}
}
This really helped me!
Also, If anyone is interested in a freelance .NET development job, please have a look at http://www.webtropy.com/articles/joboffer.asp