[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 685
  • Last Modified:

Problem with postback and user controls

Environment: ASP.NET 1.1, VB.NET, IIS

 have an ASP.NET application in which I'm using user controls. I have the user controls in various sub folders.
On my user controls I have hyperlink server controls with their NavigateUrl properties pointing to other folders with .ascx controls, but I substitute the .ascx with .aspx.
In my Application_BeginRequest method I get the Request url and retrieve the path and name of page requested substituting the .aspx with .ascx. I then use Context.Rewritepath to change the request page to a common page (.aspx) and pass the control path and name as a querystring.
The problem I'm having is on PostBacks the request url will include the previous re-written url, but I want my url to look like it looked the first time the page was visited.
The page is being taken as if it was  in the same folder as the user control where the postback is from.

If I try to remove the previuosly re-written part from the url by specifically pointing to the common page I get the following error:
The virtual path '/Default.aspx' maps to another application, which is not allowed.
My Default.aspx page is actually in the root of my application folder. The folder is set up as an application in IIS.

Thanks in advance for the help
1 Solution
That is the tricky part of URL Rewriting.. check out following 2 solutions to overcome this problem:


Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now