VS2013中的URL连接 [英] URL concatenation in VS2013

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

问题描述

嗨朋友们,

我正在用C#VS 2013开发网页项目。

i给菜单提供URL链接。

i有以下菜单:

主页,课程,申请表,联系方式

菜单网址:

首页 - > /默认

课程 - > / PageInfo /课程

申请 - > / PageInfo /申请

联系 - >> /联系

以下是我的Routeconfig代码

Hi Friends,
I am developing web project in C# VS 2013.
i give URL link to menus.
i have the following menus:
Home,Course,Application,Contact
URL for menus:
Home->/Default
Course->/PageInfo/Course
Application->/PageInfo/Application
Contact->/Contact
below is my Routeconfig code

// Register a route for Page/{PageName}
          routes.MapPageRoute(
             "Page Informations",           // Route name
             "PageInfo/{PageInfo}",                  // Route URL
             "~/Page.aspx"              // Web page to handle route
          );

          routes.MapPageRoute(
         "Home Page",           // Route name
         "Home",                  // Route URL
         "~/Default.aspx"              // Web page to handle route
     );
          routes.MapPageRoute(
      "Contactus Page",           // Route name
      "Contact",                  // Route URL
      "~/Contact.aspx"              // Web page to handle route
  );





如果我点击课程页面,URL自动更改如下:

主页 - > PageInfo /默认

课程 - > PageInfo / PageInfo /课程

应用程序 - > PageInfo / PageInfo / Application

联系人 - > PageInfo /联系



任何人都知道为什么URL与其他人联系这个。

我的菜单代码



if i click Course page, the URL automatically changed as following:
Home->PageInfo/Default
Course->PageInfo/PageInfo/Course
Application->PageInfo/PageInfo/Application
Contact->PageInfo/Contact

anyone knows why the URL Concatenate with others like this.
here my menu code

<ul id="nav">
                <li><a href="Default.aspx">Home</a></li>
                <li><a href="PageInfo/Course">Course</a></li>
                <li><a href="PageInfo/faculty">Faculty</a></li>
                <li><a href="PageInfo/Application">Application</a></li>
                <li><a href="ReachUs">Reach Us</a></li>
                <li><a href="Contact.aspx">Contact Us</a></li>
</ul>

推荐答案

{PageInfo}部分将获得来自客户端的href属性值,所以当你在href中有PageInfo / Course时,它似乎复制了PageInfo ...
The {PageInfo} part will get the href attribute value from the client, so when you have PageInfo/Course in href it seems to duplicate PageInfo...


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

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