Using a web form in MVC3

I am trying to integrate an old WebView ReportViewer into my current MVC3 project. I would like it to be available at http://<server>/Reports/ViewReport.aspx . First, I created a folder in the root of my project called Reports , left the page there, and it worked fine.

However, now I have an area, also called Reports , and I had to get rid of the folder so that the correct work by default would be correct.

How do I configure my routing so that the Webform URL appears from Reports , even if it is physically located elsewhere in my project?

+4
source share
1 answer

The easiest way to do this is to use the IIS URL Rewrite module. No changes to application code or routing. Just place your webpage somewhere in some non-MVC related folder, which is also available.

http://www.iis.net/download/urlrewrite

But otherwise, you could try to place your file directly in the area folder, since RouteCollection.RouteExistingFiles is false by default, which means that your file should be processed by a regular Asp.net web form pipeline.

The most important thing, however, is that you do not put your file in a folder with the configured System.Web.HttpNotFoundHandler handler. By default, the Views folders are configured so that the files in the subfolder tree are not accessible from the request level. Applying a course can access them (which is how MVC works anyway).

+1
source

All Articles