Server Error in '/WebClient' Application.
--------------------------------------------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review
<html>
<head>
<title>Object reference not set to an instance of an object.</title>
<style>
body {font-family:"Verdana";font-weight:normal;font-size: .7em;c
olor:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-t
op: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top
: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;col
or:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;col
or:maroon }
pre {font-family:"Lucida Console";font-size: .9em}
.marker {font-weight: bold; color: black;text-decoration: none;}
<b> Description: </b>An unhandled exception occurred during the exec
ution of the current web request. Please review the stack trace for more informa
tion about the error and where it originated in the code.
<br><br>
<b> Exception Details: </b>System.NullReferenceException: Object ref
erence not set to an instance of an object.<br><br>
An unhandled exception was generated during the execution of the current web req
uest. Information regarding the origin and location of the exception can be iden
tified using the exception stack trace below.</code>
[NullReferenceException: Object reference not set to an instance of an object.]
Interwetten.WebClient.betting.offer.Page_Load(Object sender, EventArgs e) +20
2
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +753
</pre></code>
</td>
</tr>
</table>
<br>
<hr width=100% size=1 color=silver>
<b>Version Information:</b> Microsoft .NET Framework Version:1.
1.4322.573; ASP.NET Version:1.1.4322.573
</font>
</body>
</html>
<!--
[NullReferenceException]: Object reference not set to an instance of an object.
at Interwetten.WebClient.betting.offer.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain()
[HttpUnhandledException]: Exception of type System.Web.HttpUnhandledException wa
s thrown.
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain()
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionS
tep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& compl
etedSynchronously)
-->
Press any key to continue
if you copy the whole output to a html page, you will see that is exactly what you will get using a browser
When the .NET library receives a 500 error, it creates a WebException, wrap the respsonse inside its stream and throws the exception to your application code
if it is a server error, what you see on the screen is information from the browser itself, not received from the server
if the page is displayed in the browser but you get scripting errors, then you should always get the content with WebClient or whatever networking tool
do
try
{
//use your webclient here
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
if (ex.InnerException != null)
Console.WriteLine(ex.InnerException.Message);
}