从Razor View打开ASPX页面 [英] Open ASPX Page from Razor View
本文介绍了从Razor View打开ASPX页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我的要求是,我有一个剃刀视图,其中包含文本框和按钮,当我点击按钮时我想打开aspx。有人可以通过发布示例代码来帮助。我想将文本框ID和按钮ID传递给aspx页面。
提前感谢!!
解决方案
< blockquote>看起来您的.aspx与Razor驱动的应用程序位于同一目录中。对这只猫进行修饰的最简单方法是修改你的App_Start / RouteConfig.cs文件。
public static void RegisterRoutes(RouteCollection路线)
{
routes.IgnoreRoute( {resource} .axd / {* pathInfo});
routes.IgnoreRoute( {* allaspx}, new {allaspx = @ 。* \。aspx(/。 *)跨度>})?; // 添加此
routes.MapRoute(
name: 默认,
url: {controller} / {action} / {id},
默认值: new {controller = Home,action = 索引,id = UrlParameter.Optional}
);
}
这应该允许在没有MVC应用程序试图解析它的情况下加载页面。
Hi All,
My requirement is , i have a razor view which contains textbox and a button, when i click on a button i want to open aspx. can somebody please help by posting a sample code on this. I want to pass textbox id and button id to the aspx page.
Thanks in advance!!
解决方案
It looks like your .aspx lives in the same directory as your Razor-driven application. The easiest way to skin this cat is to modify your App_Start/RouteConfig.cs file.
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.IgnoreRoute("{*allaspx}", new {allaspx=@".*\.aspx(/.*)?"}); // Add This routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); }
This should allow the page to load without the MVC application trying to parse it.
这篇关于从Razor View打开ASPX页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文