Re: How to debug a web appplication?



Is there anyway to debug an application online?
I've put output logic in the global.asax but this isn't giving me enough
information. Plus, as I'm using shared hosting I have virtually no access
to the server to perform any monitoring.

Carl

"Juan T. Llibre" <nomailreplies@xxxxxxxxxxx> wrote in message
news:eGDw8kw4GHA.2208@xxxxxxxxxxxxxxxxxxxxxxx
Here's a simple walkthrough for debugging basics :
http://msdn2.microsoft.com/en-us/library/z9e7w6cs.aspx

For deeper understanding, you'd do well to familiarize yourself with this
material :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptutorials/html/debugging_with_the__net_framework.asp




Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Carl Gilbert" <mr_carl_gilbert@xxxxxxxxxxx> wrote in message
news:1159432902.902517.67380@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi

I have implemented the ASP.NET Club Site Starter Kit on my 1&1 web
space.
I have recently been getting some errors where the page doesn't load
and just comes up blank. I have put a handler on Application_Error in
global.asax to email me whenever an error occurs. Sometimes I get upto
100 in an hour which is rather concerning.

I have looked at the error message returned but I can't seem to work
out what's causing the error.

How can I debug the application to track down the error? I have quite
a bit of experience with VB.NET so I understand the concept of break
points and stack traces but it all seems a bit scary when it's on the
web.

I have included the code I have in my global.asax and the error message
I get at the bottom of this post. Should I try running the app on
local host or is there some sort of component or change I can make
somewhere to track down the error online?

Note: I didn't write the error notification code. Theres a line which
logs to an event log. Would it help if I un-comment this and see what
that does?

Regards, Carl Gilbert

****** EVENT HANDLER ******

Protected Sub Application_Error(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim objErr As Exception = Server.GetLastError.GetBaseException
Dim strMsg As String = "Error Caught in Application_Error
event\n" + _
"<br>Error in: <a href='" + Request.Url.ToString() + "'>" +
Request.Url.ToString() + "</a>" + _
"\n<br>Error Message:" + objErr.Message.ToString() + _
"\n\n<br><br>REMOTE_ADDR: " +
Request.ServerVariables("REMOTE_ADDR") + "</a>" + _
"\n<br>HTTP_ACCEPT_LANGUAGE: " +
Request.ServerVariables("HTTP_ACCEPT_LANGUAGE") + _
"\n<br>HTTP_REFERER: " +
Request.ServerVariables("HTTP_REFERER") + _
"\n<br>HTTP_USER_AGENT: " +
Request.ServerVariables("HTTP_USER_AGENT") + _
"\n<br>HTTP_COOKIE: " +
Request.ServerVariables("HTTP_COOKIE") + "\n\n\n<br><br>Stack Trace:" +
objErr.StackTrace.ToString


'EventLog.WriteEntry("Sample_WebApp",err,EventLogEntryType.Error);
Server.ClearError()
Dim strSbj As String = "BWBFC Application Error"
ClubSiteMailer.Mailer.Send(strMsg, strSbj)

End Sub

****** ERROR MESSAGE ******

Error Caught in Application_Error event\n
Error in: http://bwbfc.co.uk/bb/default.aspx\n
Error Message:Request for the permission of type
'System.Security.Permissions.FileIOPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed.\n\n

REMOTE_ADDR: 217.37.196.9\n
HTTP_ACCEPT_LANGUAGE: en-gb\n
HTTP_REFERER: \n
HTTP_USER_AGENT: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; WinFX RunTime
3.0.50727)\n
HTTP_COOKIE: \n\n\n

Stack Trace: at System.Security.CodeAccessSecurityEngine.Check(Object
demand, StackCrawlMark& stackMark, Boolean isPermSet) at
System.Security.CodeAccessPermission.Demand() at
System.IO.Path.GetFullPath(String path) at
System.Web.Util.FileUtil.IsSuspiciousPhysicalPath(String physicalPath,
Boolean& pathTooLong) at
System.Web.Util.FileUtil.IsSuspiciousPhysicalPath(String physicalPath)
at System.Web.CachedPathData.GetConfigPathData(String configPath) at
System.Web.CachedPathData.GetConfigPathData(String configPath) at
System.Web.CachedPathData.GetConfigPathData(String configPath) at
System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath,
Boolean permitPathsOutsideApp) at
System.Web.HttpContext.GetPathData(VirtualPath path) at
System.Web.Security.UrlAuthorizationModule.IsUserAllowedToPath(HttpContext
context, VirtualPath virtualPath) at
System.Web.UI.Util.IsUserAllowedToPath(HttpContext context, VirtualPath
virtualPath) at
System.Web.SiteMapProvider.IsAccessibleToUser(HttpContext context,
SiteMapNode node) at
System.Web.SiteMapNode.IsAccessibleToUser(HttpContext context) at
System.Web.StaticSiteMapProvider.GetChildNodes(SiteMapNode node) at
System.Web.SiteMapNode.get_ChildNodes() at
System.Web.UI.WebControls.SiteMapDataSource.GetNodes() at
System.Web.UI.WebControls.SiteMapDataSource.GetPathNodeCollection(String
viewPath) at System.Web.UI.WebControls.SiteMapDataSource.GetView(String
viewName) at
System.Web.UI.WebControls.SiteMapDataSource.System.Web.UI.IDataSource.GetView(String
viewName) at
System.Web.UI.WebControls.Repeater.ConnectToDataSourceView() at
System.Web.UI.WebControls.Repeater.OnLoad(EventArgs e) at
System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at
System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at
System.Web.UI.Page.ProcessRequest() at
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at
System.Web.UI.Page.ProcessRequest(HttpContext context) at
ASP.default_aspx.ProcessRequest(HttpContext context) at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)





.