从Webform重定向到MVC ..getting错误 [英] Redirect from webform to MVC ..getting errors

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

问题描述

我正在现有MVC应用程序中试用MVC.我想从"Folder1"中的webform重定向到Controllers文件夹(与Folder1相同级别)中的MVC Homecontroller.
我尝试了此操作,找不到路径"/"的控制器或未实现IController.

I am trying out MVC in existing MVC application . I want to do redirect from webform which is in 'Folder1' to MVC Homecontroller which is in Controllers folder ,same level as Folder1.
I tried this ,its The controller for path '/' was not found or does not implement IController.

UrlHelper urlHelp = new UrlHelper(HttpContext.Current.Request.RequestContext);   
Response.Redirect(urlHelp.Action("About", "Home"), false);

甚至尝试过

Response.Redirect(HttpRuntime.AppDomainAppVirtualPath + "Home/Index");

甚至尝试过

UrlHelper urlHelp = new UrlHelper(HttpContext.Current.Request.RequestContext);           
Response.Redirect(urlHelp.Action("Index", "Home",new { area = string.Empty }),false);

不能锻炼..有人知道吗?

didn`t work out ..Anybody have idea?

推荐答案

尝试一下?

UrlHelper urlHelp = new UrlHelper(Request.RequestContext);
Response.Redirect(Request.Url.GetLeftPart(System.UriPartial.Authority) + urlHelp.Action("About", "Home"), false);

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

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