hits counter

You Don't Always Need Page Modules

From my article on Page Modules some people might have gotten the wrong impression that this would be the only way to get a reference to the page given its path, but it isn't.

You can use the System.Web.UI.PageParser.GetCompiledPageInstance method to get the reference to the page before calling the System.Web.HttpServerUtility.Transfer method.

There's one caveat, though. Unlike the version of the System.Web.HttpServerUtility.Transfer method where you that takes a virtual path as an argument, this one will not change the values of the System.Web.HttpRequest.AppRelativeCurrentExecutionFilePath and System.Web.HttpRequest.CurrentExecutionFilePath properties won't change from the original request.

That can either be a problem or the solution to a problem.

No Comments