English 中文(简体)
• 如何将交通改用蚊帐
原标题:How to tell IIS7 to redirect traffic to asp.net

用户类型:

服务器服务:

问题在于,国际空间法学会7没有发出这一请求,要求由英特网处理,因为所请求的道路在名录结构中没有双倍。

我怎么能够告诉国际会计学会,不要为每个产品和类别建立目录,就让这一请求由作为本网处理?

问题回答

在技术上,你没有国际空间法学会这样做,你利用URL Re-Writing来这样做。 这是协会的一个正常特征。 NET MVC。 然而,它也有可能使用基于“流层”的正文。

这里有一篇文章:

该条列出的就是实现这一点的若干方法,以及详细解释如何撰写一份《手册》。

事实上,该条款表明如何做你再次要求的事情。 在网页上搜索“当用户访问/查询/查询”时,请你说明如何工作。 (条款中指示数较高)

页: 1 反之,使用IIS7 Url Re 作家:

使用URL Rewrite

你有两个解决办法:

  1. Use a

    <rewrite>
      <rewriteMaps>
        <rewriteMap name="StaticRewrites">
          <add key="/products/category/electronics" value="/products.aspx?category=45" />
          <add key="/products/category/books" value="/products.aspx?category=46" />
          <add key="/products/category/dvds" value="/products.aspx?category=47" />
        </rewriteMap>
      </rewriteMaps>
      <rules>
        <rule name="Rewrite Rule 1 for StaticRewrites" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <add input="{StaticRewrites:{REQUEST_URI}}" pattern="(.+)" />
          </conditions>
          <action type="Rewrite" url="{C:1}" appendQueryString="False"/>
        </rule>
      </rules>
    </rewrite>
    
  2. 使用更多的“动力”改写器:

    <rewrite>
      <rules>
        <rule name="RedirectUserFriendlyURL1" stopProcessing="true">
          <match url="^products.aspx$" />
          <conditions>
            <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
            <add input="{QUERY_STRING}" pattern="^([^=&amp;]+)=([^=&amp;]+)$" />
          </conditions>
          <action type="Redirect" url="products/{C:1}/{C:2}" appendQueryString="false" />
        </rule>
        <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
          <match url="^products/([^/]+)/([^/]+)/?$" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="products.aspx?{R:1}={R:2}" />
        </rule>
      </rules>
    </rewrite>
    

    在上述情况下,您需要更换<代码>products.aspx网页,以接受该类别的名称,然后在该网页上查看数据库中该类别的实际分类账。

将责任转嫁给国际空间法研究所(URL Rewrite)单元(或Iconics IIRF或HeliconTech ISAPI Rewrite等任何其他作者)意味着,你可以单独修改这些规则,而不是将其焚烧成你的法典。 将这些规则列入你的法典意味着,你必须随时重新部署。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签