According to a recent Microsoft article, we should do this:
void Application_BeginRequest(object source, EventArgs e) {
if (Request.Path.IndexOf('\\') >= 0 ||
System.IO.Path.GetFullPath(Request.PhysicalPath) !=
Request.PhysicalPath) {
throw new HttpException(404, "not found");
}
}
from now on in our global.asax.cs files for web apps. I'd like to just
modify VS.NET so that it automatically does that when new projects are
created. However, I don't see global.asax.cs as a template anywhere. I see
global.asax, but not it's codebehind.
Is there a way to make this code automatic on all new C# web projects in
Visual Studio 2003?
Martin Kulov - 09 Oct 2004 23:02 GMT
Hi Scott,
Microsoft provided HTTP module that you only need to install once on your web site to prevent this issue. I suppose you can use the dll as a part of your project also.
HTH,
Martin Kulov
> According to a recent Microsoft article, we should do this:
>
[quoted text clipped - 12 lines]
> Is there a way to make this code automatic on all new C# web projects
> in Visual Studio 2003?