首页 > 解决方案 > SEO 友好 URL asp.net 动态喜欢 http://somewebsite/WebForm1.aspx?postid=1

问题描述

尊敬的查看者,我有一个问题,我在 asp.net 网络表单 webform1 和 webform2 中有 2 页现在我们将数据库中的数据绑定到网格视图中的 webform 1 上,只显示类似于 ex 的标题。苹果现在从数据库绑定,当用户点击苹果时,我们使用响应重定向http://somewebsite/WebForm2.aspx?postid=1这样的页面将在 webform 2 上重定向,并且从数据库中绑定数据仅关于苹果意味着 ID= 在哪里1 但我想做 http://somewebsite/WebForm2/postid/1/Apple Like in this format Get this url and fetch details about only Apple from database (apple is just used for example) we can do this i much try并在 google 和 youtube 上搜索,但我没有成功

希望有人帮助我解决这个问题

我已经尝试从 stackoverflow 网站查看我已经看到一个对 seo 友好的东西,但它明确声明或者我不明白:(

标签: c#asp.netformsweb

解决方案


我们使用 Global.asax 这是一个代码示例 我们只需要路由 URL

    using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Web.Routing;
namespace a2zcrackworld
{
    public class Global : System.Web.HttpApplication
    {
        void RegisterRoutes(RouteCollection routes)
        {
            routes.MapPageRoute("Home", "software", "~/software.aspx");
            routes.MapPageRoute("Downloadsoft", "download/soft/{SoftwareID}", "~/downloadsoftware.aspx");
            routes.MapPageRoute("Opratingsystem", "operating", "~/OpratingSystem.aspx");
 }
        void RegisterRoutessoftware(RouteCollection routes)
        {


        }
        protected void Application_Start(object sender, EventArgs e)
        {
            RegisterRoutes(RouteTable.Routes);
            RegisterRoutessoftware(RouteTable.Routes);
        }
}

推荐阅读