手机
当前位置:查字典教程网 >编程开发 >asp.net教程 >aspx文件格式使用URLRewriter实现静态化变成html
aspx文件格式使用URLRewriter实现静态化变成html
摘要:使用asp.net开发的网页程序,使用URLRewriter.dll实现静态化。A.下载URLRewriter.rar,解压后放在/bin/...

使用asp.net 开发的网页程序,使用URLRewriter.dll 实现静态化。

A. 下载URLRewriter.rar,解压后放在/bin/目录下

B. 将URLRewriter.rar 加入工程引用。

C. 配置IIS 站点,将扩展名为html 指向处理程序aspnet_isapi.dll。

IIS 站点->属性->主目录->配置->添加

可执行文件和aspx 处理相同,都是 c:windowsmicrosoft.netframeworkv2.0.50727aspnet_isapi.dll

特别注意,一定不要选择检查文件是否存在。

D. 在web.config 中添加配置内容,压缩包里有。

复制代码 代码如下:

<configSections>

<section name="RewriterConfig"

type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />

</configSections>

<>

<RewriterConfig>

<Rules>

<RewriterRule>

<LookFor>~/(d*).html</LookFor>

<SendTo>~/user/default.aspx?link=$1</SendTo>

</RewriterRule>

</Rules>

</RewriterConfig>

<system.web>

<>

<httpHandlers>

<add verb="*" path="*.aspx"

type="URLRewriter.RewriterFactoryHandler, URLRewriter" />

<add verb="*" path="*.html"

type="URLRewriter.RewriterFactoryHandler, URLRewriter" />

</httpHandlers>

E. 在地址栏输入[url]http://localhost/1.html[/url] 指向[url]http://localhost/user/default.aspx?link=1[/url]

基于Apache HTTP Server 静态化Apache Web Server 的配置(conf/httpd.conf )

A. 在httpd.conf 文件中查找LoadModule rewrite_module modules/mod_rewrite.so

通常该行被注释,去掉“#”。如果没有就增加该行。

B. 加入代码:

复制代码 代码如下:

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteRule ^/([0-9]+).html$ /user.php?user=$1

</IfModule>

C. 如果网站使用通过虚拟主机来定义,请务必加到虚拟主机配置文件.htccess 中去,否则可能

无法使用。

D. 重启Apache,重新载入配置。

E. 在地址栏输入[url]http://localhost/1.html[/url] ,实际指向[url]http://localhost/user.php?user=1[/url]

【aspx文件格式使用URLRewriter实现静态化变成html】相关文章:

asp.net repeater实现批量删除第1/2页

asp.net中包含文件的代码及使用方法

使用pdfbox实现pdf文本提取和合并功能示例

asp.net 生成静态时的过滤viewstate的实现方法

ashx文件的使用小结

asp.net GridView和DataList实现鼠标移到行行变色

ashx中使用session的方法

asp.net在后端动态添加样式表调用的方法

ASP.NET 运行.bat文件的实现方法

asp.net中利用ashx实现图片防盗链代码

精品推荐
分类导航