MVC中的URL问题 [英] Problem with URL in MVC

查看:79
本文介绍了MVC中的URL问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个域名www.xyz.com,我主持我的mvc应用程序,



i创建一个控制器,仅用于从menulink重定向,



假设



控制器 - > goto

action - > A1 {从这里我称之为另一个动作..使用RedirectToAction();功能}



假设 - > RedirectToAction(A2,C1);



点击链接后,这将生成URL

Like->

www.xyz.com/xyz.com/C1/A2

我是MVC的新手,所以我无法解决这个问题,请帮助我和

让我知道如何设置动作和控制器名称

RedirectToAction();.

或者我必须做的其他事情。

i have a domain suppose www.xyz.com,and there i host my mvc application,

i create a controller only for redirection from menulink,

suppose

Controller -> goto
action -> A1 {from here I called another action..with RedirectToAction(); function}

Suppose -> RedirectToAction("A2","C1");

when clicked the link ,this will genarate URL
Like->
www.xyz.com/xyz.com/C1/A2
I am new in MVC so that i cant fix this,please help me and
let me know how to set action and controller name in
RedirectToAction();.
Or some thing else i have to do.

推荐答案

尝试如下

Try like below
return RedirectToAction("Index", "ControllerName");



希望这有帮助


Hope this helps


检查这个

http://stackoverflow.com/questions/10785245/redirect-to-action-in-另一个控制器 [ ^ ]


这篇关于MVC中的URL问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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