Sep 7th, 2009 | No Comments

The following code snippet will help you to catch an error in the global.asax file,

Turn off the custom error mode in web.config file first,

<customErrors mode="Off">

And add this code in your global.asax file to catch the error,

void Application_Error(object sender, EventArgs e)
 {
 HttpContext context = ((HttpApplication)sender).Context;
 if (context.Error != null)
 {
 Exception ex = context.Error;
 string msg = string.Empty;

 while (ex != null)
 {
 if (!string.IsNullOrEmpty(ex.Message))
 msg += ex.ToString() + "<br /><br />";
 ex = ex.InnerException;
 }
 context.Response.Clear();
 context.Response.Write(msg);
 context.Response.End();
 }
 } 

Hope this helps :)

Written by Ajay Matharu

September 7th, 2009 at 9:53 am

Aug 28th, 2009 | 1 Comment

I have been getting good response for my post Integrating blog engine into existing site. One of the guy asked me this question on how can we do the opposite? He had a BlogEngine as parent site and needed some other site to be child of BlogEngine. So He posted on that and this is the answer he got for his question.

You need to make this change in your web.config file. If you want to have a website as child of BlogEngine

<location path="." inheritInChildApplications="false">
 <system.web>
 ..... existing content .....
 </system.web>
</location>

<location path="." inheritInChildApplications="false">
 <system.webServer>
 ..... existing content .....
 </system.webServer>
</location>

Written by Ajay Matharu

August 28th, 2009 at 11:48 pm

Page 2 of 24123451020Last »