简体   繁体   English

Asp.net URL重写

[英]Asp.net URL Rewriting

I would like to use the ASP.Net URL Rewriting to achieve the following: 我想使用ASP.Net URL重写来实现以下目的:

My application is physically hosted in the IIS at the following end point: http://www.example.com/someIISApplication/Default.aspx 我的应用程序在以下端点上物理托管在IIS中: http : //www.example.com/someIISApplication/Default.aspx

I want the user to make a request with the following URL and hit the above end point with a querystring parameter like this: 我希望用户使用以下URL发出请求,并使用如下所示的querystring参数达到上述终点:

Requested from browser: http://www.example.com/ABC/someIISApplication/Default.aspx 从浏览器请求: http : //www.example.com/ABC/someIISApplication/Default.aspx

This is how it actually hits the ASP.Net after route processing: http://www.example.com/someIISApplication/Default.aspx?MyParam=ABC 路由处理后,它实际上是如何到达ASP.Net的: http : //www.example.com/someIISApplication/Default.aspx? MyParam=ABC

You can use URL Rewrite Module for IIS . 您可以使用IIS URL重写模块

Create redirect rule on the site level (www.example.com) 网站级别 (www.example.com)创建重定向规则

Pattern: ^([_0-9a-z-]+)/someIISApplication/Default.aspx 模式: ^([_ 0-9a-z-] +)/ someIISApplication / Default.aspx

Redirect URL: someIISApplication/Default.aspx?MyParam={R:1} 重定向URL: someIISApplication / Default.aspx?MyParam = {R:1}

For more details see "Creating Rewrite Rules for the URL Rewrite Module" 有关更多详细信息,请参见“为URL重写模块创建重写规则”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM