views:

94

answers:

1

Hi guys,

Is there any way to find out if ASP.Net runtime has served a cached copy of ASPX page or actually went through the page life cycle?

Here is my problem:

I'm seeing many entries in my IIS log files that were served successfully (200 OK). I've a corresponding logging code (Log4Net API) in the Session_Start and Application_BeginRequest() events that is logging every request to my DB with more details. I'm not seeing any corresponding entries in my SQL DB for some cases that should have been created by Log4Net code.

Are there any logs available to find out if a cached copy was served by .NET worker process? Moreover, if my logging code would throw an exception, won't that show up as 500 in IIS logs?

The code is on Windows 2008 Server, IIS 7.

PS: If coding assembly resolve event and logging into a database can help track this? Can somebody point me to an example?

+1  A: 

Hi,
If you don't want to manually add more logging, then you could just turn on tracing. To turn on tracing, open up your web.config and find the ... tag. Set enabled="true", save the web.config, then you can go to http://{your site}/trace.axd and view the page trace events.

You can test to see if you can see caching calls by first viewing a page, then clicking away and going back to it, then checking the trace to see the differences in the events that are recorded. You should see cache fetching in the trace of the second page view.

Here's more info about this great feature from MS: http://msdn.microsoft.com/en-us/library/1y89ed7z(VS.71).aspx

You also have the ability in your code to write to the trace output using Trace.Write or Trace.Warn. It's a great way to add a bit of debugging code that will only run when Tracing is enabled.

HTH, Lance

Lanceomagnifico
Thank Lance. I know tracing is one option. The only issue is that code is in production environment and I'll have to wait till the patch passes through two test environments. Secondly, ASPX pages are called through JBOSS server and thats where I'm getting issues, sporadically to add to the misery.
Vishal Seth