惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy International News Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
O
OpenAI News
Cloudbric
Cloudbric
Google Online Security Blog
Google Online Security Blog
Schneier on Security
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tenable Blog
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
V
Visual Studio Blog
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 三生石上(FineUI控件)
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
L
LangChain Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东

博客园 - Be Myself

安装Docker Toolbox后出现的问题 SharePoint 2013 必备组件之 Windows Server AppFabric 安装错误 Exchange WebSerivce Usage 日志记录组件 Could not load file or assembly 'System.Data.SQLite' or one of its dependencies Visual Studio 2012 cannot identify IHttpActionResult distributed caching for .net applications HTTP Error 503. The service is unavailable windows 7 HTTP Error 500.21 - Internal Server Error resolution ! C#字符串反转 - Be Myself - 博客园 HTTP could not register URL http://+:****/WCFService/. Your process does not have access rights to this namespace CSpider 安装和配置branchcache asp.net下url参数含有中文读取后为乱码 找出数组中是否有重复的数 时间复杂度为O(n)的排序算法 IIS 7.0 HTTP 错误 404.3 - Not Found解决办法 博文阅读密码验证 - 博客园 MSMQ, WCF and IIS: Getting them to play nice (Part 3)[转]
ASP.NET 中执行 URL 重写
Be Myself · 2014-06-03 · via 博客园 - Be Myself

具体实现步骤(其中的一种实现方法):

  一、下载相关的DLL(ActionlessForm.dll和UrlRewriter.dll

    http://download.csdn.net/detail/yingwanghbx/4510059

  二、在项目中引用那两个DLL文件

    右击项目,点击Add Reference,选择Browse,然后选择相应的DLL,点击OK即可。

  三、添加browser文件

  1、右击项目,点击Add-New Item,选择Browser File,取个有意义的名字。在生成的*.browser文件的browsers节点中添加如下代码:

复制代码

<!--URLRewriter-->
    <browser refID="Default">
      <controlAdapters>
        <adapter controlType="System.Web.UI.HtmlControls.HtmlForm"
               adapterType="URLRewriter.Form.FormRewriterControlAdapter"/>
      </controlAdapters>
    </browser>

复制代码

  2、在配置文件web.config中system.web节点内添加httpModules

<!--URLRewriter
    type:HttpModule的标识号和类库名称
    name:取一个较为友好的名称-->
    <httpModules>
      <add type="URLRewriter.RewriterModule, URLRewriter" name="RewriterModule"/>
    </httpModules>

  3、然后就是在configuration节点下添加(必须是第一个子节点):

复制代码

<!--URLRewriter-->
  <configSections>
    <section name="CustomConfiguration" type="URLRewriter.Config.UrlsSection, URLRewriter"/>
  </configSections>
  <CustomConfiguration>
    <urls>
      <!--([\w]+)表示,1到n个字母或数字或下划线或汉字组成-->
      <add virtualUrl="~/Default/([\w]+)*" destinationUrl="~/Default.aspx?username=$1"/>
      <add virtualUrl="~/Default/([\w]+)*/([\w]+)*" destinationUrl="~/Default.aspx?newsTypeId=$1&amp;newsWhere=$2"/>
      <add virtualUrl="~/page/user/login" destinationUrl="~/page/user/login.aspx"/>
      <add virtualUrl="~/page/user/registe" destinationUrl="~/page/user/registe.aspx"/>
      <add virtualUrl="~/page/index" destinationUrl="~/page/index.aspx"/>
    </urls>
  </CustomConfiguration>

复制代码

  如上,在不需要传参的情况下,可以直接在virtualUrl里面写要转化地址,destinationUrl为真实地址。在需要传参的情况下,用正则表达式代替,多个参数,在destinationUrl中用&amp分隔,在virtualUrl中用自己规定的符号代替,我是用的‘/’分隔的。

  4、测试,在Default的Page_Load中添加如下代码

if (!string.IsNullOrEmpty(Request.Params["newsTypeId"]))
{
    string newsId = Request.Params["newsTypeId"].ToString();
    string newsWhere = Request.Params["newsWhere"].ToString();
    Response.Write("newsid:" + newsId + "<br/>newsWhere:" +newsWhere);
} 

结果如下:

  5、加入窗体回传保持的组件:

  在你的这个页面中加入: <%@ Register TagPrefix="skm" Namespace="ActionlessForm" Assembly="ActionlessForm" %> 再把你的<Form...>改为: <skm:Form id="你的表单名" method="post" runat="server"> ..... </skm:Form>

  6、在IIS7.5里配置

在IIS中新建网站(端口号8111)

      直接运行http://localhost:8111/

    错误截图

配置方法:

二、添加通配符脚本映射,选择:C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll

三、找到和网站相对的连接池,选择framework 4.0  经典模式

四、选择应用程序连接池,高级设置,启用32位应用程序,设为true