zoukankan      html  css  js  c++  java
  • 2018-10-07

    1>使用core来构建一个简单的web系统.

    2>加入了Microsoft.AspNetCore.Rewrite,来对url进行重写。

    3>第一次使用ViewComponent,有点像ascx的感觉。

    4>设计思路

    菜单 Rewrite 来重写

    菜单 ViewComponent来生成。

    QQ,二维码这些,我要报名,还是用部分视图来处理吧。

    类别1/明细

    类别2/明细

    新闻/明细

    像这样来吧。

    继续前进。完成更多的。比完美更重要。要记得。

    要点

    RewriteOptions 从数据库读取数据?

    容易控制,想怎么来就怎么来。会不会有性能问题?

    还是使用iis的重写?

    参考 https://www.cnblogs.com/yanzhen/archive/2012/01/07/iis7-wei-jing-tai.html

    <?xml version="1.0"?>

    <configuration>
    <system.webServer>
            <rewrite>
                <rules>
                    <!--301重定向把不带3W的域名 定向到带3W-->
                    <rule name="Redirect" stopProcessing="true">
                        <match url=".*" />
                        <conditions>
                            <add input="{HTTP_HOST}" pattern="^haoxinwen.info$" />
                        </conditions>
                        <action type="Redirect" url="http://www.haoxinwen.info/{R:0}" redirectType="Permanent" />
                    </rule>
                    <!--首页-->
                    <rule name="rD">
                        <match url="^$" />
                        <action type="Rewrite" url="Default.aspx" />
                    </rule>
                    <!--产品列表-->
                    <rule name="rP">
                        <match url="^product/$" />
                        <action type="Rewrite" url="ProductList.aspx" />
                    </rule>
                    <!--产品列表第几页-->
                    <rule name="rPL">
                        <match url="^product/list-([0-9]*).html$" />
                        <action type="Rewrite" url="ProductList.aspx?page={R:1}" />
                    </rule>                
                    <!--产品类别列表-->
                    <rule name="rPT">
                        <match url="^product/([A-Za-z0-9-]*)/$" />
                        <action type="Rewrite" url="ProductList.aspx?typeUrl={R:1}" />
                    </rule>
                    <!--产品类别列表第几页-->
                    <rule name="rPTL2">
                        <match url="^product/([A-Za-z0-9-]*)/list-([0-9]*).html$" />
                        <action type="Rewrite" url="ProductList.aspx?typeUrl={R:1}&amp;page={R:2}" />
                    </rule>
                    <!--产品详细-->
                    <rule name="rPd">
                        <match url="^product/([A-Za-z0-9-]*)/([A-Za-z0-9-]+).html$" />
                        <action type="Rewrite" url="ProductDetail.aspx?typeUrl={R:1}&amp;url={R:2}" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>
  • 相关阅读:
    linux 查询文件在多个目录里面,只保留一个
    mysql 定时备份
    mysql 赋予权限报错Column count of mysql.user is wrong. Expected 45, found 43. The table is probably corrupted
    Mysql 启动报错Error: page 5 log sequence number 2580579963
    docker 限制日志文件大小和数量
    docker 安装
    MVC3学习第十五章 武林外传大结局
    MVC3学习第十四章 佟掌柜第三弹——MVC3下利用陕北吴旗娃的验证码控件实现验证码功能以及在mvc3下使用编辑器
    MVC3学习第十三章 佟掌柜第二弹——MVC3下利用陕北吴旗娃的分页控件实现数据分页
    MVC3学习第十二章 佟掌柜第一弹----利用MVC3实现用户的注册登录和了解MVC中的分部视图、用户控件
  • 原文地址:https://www.cnblogs.com/forhell/p/9750693.html
Copyright © 2011-2022 走看看