You need to handle
Application_BeginRequest
event of
Global.asax
file as following.
protected void Application_BeginRequest(object sender, EventArgs e)
{
string url = HttpContext.Current.Request.Url.AbsolutePath;
string extension = System.IO.Path.GetExtension(url);
switch (extension.ToLower())
{
case ".xml":
break;
}
}