Jaa


CRM 4.0, SharePoint and ASP.NET Trace

Sometimes I tend to forget how much stuff is built into .NET Framework. Framework gives you nice set of features that you can use without writing a single line of code. ASP.NET Trace is one of them. I know that it's nothing new but I think that it's still used mainly in custom ASP.NET applications. But if you work with products like CRM or SharePoint... you kind of forget that those applications are built on top of ASP.NET and you can still benefit from the features that are part of the framework. So let's refresh our memory so that we can use this feature to build better solutions.

See also good post regarding tracing SharePoint in here "Enabling Page Level Tracing For SharePoint ASPX Forms".

Okay let's first enable trace at the web.config (same changes apply for CRM and SharePoint):

 1234567891011
 <?xml version="1.0"?><configuration> <!-- ... --> <system.web>  <!-- ... -->  <trace requestLimit="100" enabled="true"/>  <compilation debug="true" />  <!-- ... --> </system.web> <!-- ... --></configuration>

So in order to enable the trace you just have to make sure that you have trace (line 6) and debug enabled (line 7). After that you're good to go and trace your application.

I just retrieved front page from my SharePoint (https://demo1) and then clicked url to custom application page. Then I typed in the trace url https://demo1/Trace.axd and checkout the results:

SharePoint trace

And in more detailed (I just clicked the Pages/Default.aspx):

SharePoint trace detailed

And same thing works with CRM 4.0 too... but remember that it's unsupportedto modify web.config in CRM so create back up copy so that you can restore the original file when you need to clean up your modifications.

In my CRM I opened url https://crmserver/Contoso to goto tenant named Contoso. After that I used my custom aspx page from ISV-folder. And then I checked the trace:

CRM Trace

And if you look at more detailed view of the trace:

CRM Trace details

And you can easily see the amount of stuff that is put into the application state and especially for CRMWindowInfo_CacheKey. Using this technique you can find e.g performance issues in your code quite easily.

I actually used this method to debug some AJAX and web services issues and it worked really well because I could check out from the trace what has happened and when.

To summarize.... you should refresh your memory about things that you get straight from the platform. It can save lot of your time. At least it happened to me :-)

Anyways... Happy hacking!

J

Comments

  • Anonymous
    February 23, 2008
    PingBack from http://www.biosensorab.org/2008/02/23/crm-40-sharepoint-and-aspnet-trace/

  • Anonymous
    April 22, 2008
    I've noticed on a few projects I've helped out on that it's not always common knowledge for others on

  • Anonymous
    May 06, 2008
    Every now and then I’m find myself trying to solve same issues over and over again :-) That’s why I found