目的:便于搜索引擎抓取

url重写:将带参数的url如:https://i.cnblogs.com/EditPosts.aspx?opt=1.修改为https://i.cnblogs.com/EditPosts.aspx_1

1:在BookList修改如下链接方式

href="<%#Eval("Id","/Goods/BookDetail_{0}.aspx") %>">

2:添加Global文件

在Application_BeginRequest方法进行url地址的重写

protected void Application_BeginRequest(Object sender, EventArgs e)
{
string url = Request.AppRelativeCurrentExecutionFilePath;//~/Goods/BookDetail_4939.aspx
Match match=Regex.Match(url, @"~/Goods/BookDetail_(\d+).aspx");
if (match.Success)
{
Context.RewritePath("/Goods/BookDetail.aspx?id="+match.Groups[1].Value);
}
}

超链接技巧:由于SEO执行js脚本

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SeoTest.aspx.cs" Inherits="BookShop.Web.Test.SeoTest" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="../js/jquery-1.7.1.js"></script>
<script type="text/javascript">
$(function () {
$("#a1").click(function () {
$.post("/ashx/seo.ashx", {}, function (data) {
$("#div1").append(data);
});
return false;
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<a href="Javascript:void(0)" id="a1">mmm</a>
<div id="div1"></div> </div>
</form>
</body>
</html>

原来的代码

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SeoTest.aspx.cs" Inherits="BookShop.Web.Test.SeoTest" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="../js/jquery-1.7.1.js"></script>
<script type="text/javascript">
$(function () {
$("#a1").click(function () {
$.post("/ashx/seo.ashx", {}, function (data) {
$("#div1").append(data);
});
return false;
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<a href="/ashx/seo.ashx" id="a1">mmm</a>
<div id="div1"></div> </div>
</form>
</body>
</html>

修改后

仅仅修改了: <a href="/ashx/seo.ashx" id="a1">mmm</a>

最新文章

  1. Vs2015智能提示英文?
  2. JavaBean组件的基本使用-语法
  3. 从C# 到 OC
  4. input覆盖select实现select可写可选择
  5. [转]ORACLE的ProC用法讲解
  6. MyBatis参数传入集合之foreach动态sql
  7. File的getParentFile()和getParent()
  8. 【Android 应用开发】BluetoothSocket详解
  9. java中的i++与++i的区别以及除法、模的用法(基础)
  10. 在IT行业获得成功 你只需一项技能[转]
  11. 4-20模块 序列化模块 hashlib模块
  12. Ajax 执行顺序
  13. SQL Server 临时表和表变量系列之选择篇
  14. [转]Kindle 推送教程:教你用电子邮箱推送电子书
  15. [洛谷 P3787] 冰精冻西瓜
  16. 嵌入式ROOTFS transplantation
  17. npm与gulp的使用
  18. js数组遍历 千万不要使用for...in...
  19. 写给在Java和.net中徘徊的新手
  20. ibatis 调用存储过程

热门文章

  1. mybatis-plus调用自身的 selectById 方法报错:org.apache.ibatis.binding.BindingException:
  2. CF1108F MST Unification
  3. 从无文件技术到使用隐写术:检查Powload的演变
  4. eMMC基础技术3:eMMC总线token
  5. opencv处理验证码python代码
  6. SPOJ - DQUERY D-query 主席树
  7. HDU 4455
  8. JS 手机端多张图片上传
  9. 使用SimHash进行海量文本去重[转]
  10. Confluence 6 配置默认语言界面