如何从MVC3应用程序导航到Web Forms ASPX页面?

时间:2021-08-08 08:22:59

I find myself having to create a Web Form page in my MVC3 application to host the ReportView control, for displaying rdlc reports for my users. I see quite an abundance of advice on how to go about this all, and it seems pretty simple.

我发现我必须在我的MVC3应用程序中创建一个Web表单页面来托管ReportView控件,以便为我的用户显示rdlc报告。我看到了很多关于如何处理这一切的建议,而且看起来很简单。

What I would like to know is how do I get from a Razor based view to this report viewer page? Do I simply 'hard-code' a content url to the page, or is there some more polite way?

我想知道的是,如何从基于Razor的视图转到报告查看器页面?我是简单地“硬编码”页面的内容url,还是有更礼貌的方式?

2 个解决方案

#1


0  

You could use the Url.Content helper:

您可以使用Url。内容辅助:

<a href="@Url.Content("~/report.aspx")">Show me the report</a>

#2


1  

You can do this by adding route in global.asax file.

您可以通过在全局中添加路由来实现这一点。asax文件。

     routes.MapRoute(
         "ReportRoute",                         // Route name
         "Reports/{reportname}",                // URL
         "~/Reports/{reportname}.aspx"   // File
      );

Check out LeftyX solution with source code.

用源代码检查LeftyX解决方案。

#1


0  

You could use the Url.Content helper:

您可以使用Url。内容辅助:

<a href="@Url.Content("~/report.aspx")">Show me the report</a>

#2


1  

You can do this by adding route in global.asax file.

您可以通过在全局中添加路由来实现这一点。asax文件。

     routes.MapRoute(
         "ReportRoute",                         // Route name
         "Reports/{reportname}",                // URL
         "~/Reports/{reportname}.aspx"   // File
      );

Check out LeftyX solution with source code.

用源代码检查LeftyX解决方案。