A
Alan Silver
Hello,
I have a page where site owners can see orders placed on their site. The
path to this page is /dap/order.aspx, but for security reasons (as they
will end up printing these pages and sending them to customers) I am
trying to rewrite the path so the URL shown in the page footer is not a
real one.
I want to use an URL like http://www.domain.com/order123.aspx and have
it rewritten to http://www.domain.com/dap/order.aspx?orderid=123
I have the following in the global.asax...
void Application_BeginRequest(Object sender , EventArgs e) {
string strPath = Request.Path.ToLower();
if (strPath.StartsWith("/order")) {
strPath = strPath.Substring(6);
strPath = strPath.Replace(".aspx", "");
Context.RewritePath("/dap/order.aspx?orderid=" + strPath);
}
}
When I try to access http://www.domain.com/order123.aspx, I get
redirected to http://www.domain.com/ instead of the /dap/order.aspx
page.
If I change the Context.RewritePath to Response.Redirect, then the
order.aspx page loads fine, but obviously shows the real URL instead of
the fake one.
Anyone any idea why this is happening? I had this working some time ago
and haven't looked at it recently. I revisited this page as I have
loaded version 2.0 of the framework, and was converting these pages to
use master pages. I don't know if the new version of the framework works
differently, or if it's configuring the /dap folder as a separate
application (which was around the same time) has done it.
Any help appreciated.
I have a page where site owners can see orders placed on their site. The
path to this page is /dap/order.aspx, but for security reasons (as they
will end up printing these pages and sending them to customers) I am
trying to rewrite the path so the URL shown in the page footer is not a
real one.
I want to use an URL like http://www.domain.com/order123.aspx and have
it rewritten to http://www.domain.com/dap/order.aspx?orderid=123
I have the following in the global.asax...
void Application_BeginRequest(Object sender , EventArgs e) {
string strPath = Request.Path.ToLower();
if (strPath.StartsWith("/order")) {
strPath = strPath.Substring(6);
strPath = strPath.Replace(".aspx", "");
Context.RewritePath("/dap/order.aspx?orderid=" + strPath);
}
}
When I try to access http://www.domain.com/order123.aspx, I get
redirected to http://www.domain.com/ instead of the /dap/order.aspx
page.
If I change the Context.RewritePath to Response.Redirect, then the
order.aspx page loads fine, but obviously shows the real URL instead of
the fake one.
Anyone any idea why this is happening? I had this working some time ago
and haven't looked at it recently. I revisited this page as I have
loaded version 2.0 of the framework, and was converting these pages to
use master pages. I don't know if the new version of the framework works
differently, or if it's configuring the /dap folder as a separate
application (which was around the same time) has done it.
Any help appreciated.