网址改写问题 [英] Url Rewritting Issue

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

问题描述

朋友,
我在这里有一个网址.
www.abc.com
现在我要输入
www.abc.com/Faq
那么它应该使用帐户控制器"重定向到常见问题解答"页面.

我在这里使用此代码.

Global.ascx页面代码

Hi Friends,
Here i have an url.
www.abc.com
now i want if i enter
www.abc.com/Faq
then it should redirect to Faq page using Account Controller.

Here i am using this code.

Global.ascx Page Code

routes.MapRoute(""
               , "Faq"
                 , new { controller = "Account", action = "Faq" });


控制器代码


Controller Code

public class AccountController : Controller
    {
        public ActionResult Faq()
        {
            return View();
        }
    }


现在,如果我输入网址www.abc.com/Faq
,我想打开Faq.cshtml.
您能帮我怎样重定向到常见问题"页面,其操作方法包含在帐户控制器"中.

我想要网址


Now i want to open Faq.cshtml if i entered url www.abc.com/Faq

can you help me how can i redirect to page "Faq" whose action method contained in Account Controller.

i want url

www.abc.com/Faq


插入


insted of

www.abc.com/Account/Faq



请做有需要的....................
谢谢



Please do needful....................
Thanks

推荐答案

您应该使用 ^ ],您甚至可以在每个文件夹中放置一个web.config,并且在该配置中仅设置了默认文档.



--Amit
You should use Web.config defaultDocument[^], and you can even put a web.config in each folder, and inside that config just have the default document set.



--Amit


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

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