如何从webforms重定向到MVC? [英] How to redirect from webforms to MVC?

查看:97
本文介绍了如何从webforms重定向到MVC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。



我正在尝试从网络表单按钮重定向到mvc页面:



Hello.

I'm trying to redirect from web forms button to mvc page:

this.btnBar.ButtonCustom1.NavigateUrl = this.ResolveUrl( @"~/Profile/Info/Edit" )





它转到索引...如何更改它以将其发送到索引,参数名称为



It goes to the index...How can i change it to send it to the index with parameter name

ActionResult Index( string name )

或直接转到

ActionResult Edit()





谢谢



我尝试过:



已经尝试过不同类型的重定向转到500错误。



感谢回复...但已经尝试了网址...问题是由于mvc进程它总是首先使用name参数null索引...所以而不是去@〜/ Profile / Info /编辑它总是去@〜/ Profile / Info / Info...



Thanks

What I have tried:

Already tried different kinds of redirect going to the 500 error.

Thanks for reply...but already tried the url...problem is that due to mvc process it always goes to index first with name parameter null...so instead of going to @"~/Profile/Info/Edit" it always goes to @"~/Profile/Info/Info"...

推荐答案

WebForms不理解MVC网址约定所以我害怕你只需要知道网址自己重定向并构建它。



WebForms doesn't understand MVC url conventions so I'm afraid you're just going to have to know the url to redirect to and construct it yourself.

this.btnBar.ButtonCustom1.NavigateUrl = @"/Profile/Info/Edit?name=" + HttpUtility.UrlEncode(nameParam);


这篇关于如何从webforms重定向到MVC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆