How to debug a web appplication?

C

Carl Gilbert

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)
 
C

Carl Gilbert

I also get this error quite a lot:


****** IMAGE FETCH ERROR ******
Error Caught in Application_Error event\n
Error in: http://bwbfc.co.uk/bb/imagefetch.ashx?size=1&imageid=118\n
Error Message:Object reference not set to an instance of an object.\n\n

REMOTE_ADDR: 198.36.87.81\n
HTTP_ACCEPT_LANGUAGE: en-gb\n
HTTP_REFERER:
http://bwbfc.co.uk/bb/Photoalbum_contents.aspx?Albumid=10\n
HTTP_USER_AGENT: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
..NET CLR 1.1.4322)\n
HTTP_COOKIE: \n\n\n

Stack Trace: at ImageFetch.writeSingleImage(Int32 ImageID, Int32 size,
Stream output) at ImageFetch.ProcessRequest(HttpContext context) at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously
 
C

Carl Gilbert

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
 
J

Juan T. Llibre

I should have added that local debugging usually is just as good
as remote debugging, so give it a try on your development machine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top