aspx文件格式使用URLRewriter实现静态化变成html

如何隐藏aspx文件格式,变成html,使用asp.net 开发的网页程序,使用URLRewriter.dll 实现静态化,接下来将介绍下具体操作步骤,感兴趣的朋友可以参考下

使用asp.net 开发的网页程序,使用URLRewriter.dll 实现静态化。
A. 下载URLRewriter.rar,解压后放在/bin/目录下
B. 将URLRewriter.rar 加入工程引用。
C. 配置IIS 站点,将扩展名为html 指向处理程序aspnet_isapi.dll。
IIS 站点->属性->主目录->配置->添加
可执行文件和aspx 处理相同,都是 c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll
特别注意,一定不要选择检查文件是否存在。
D. 在web.config 中添加配置内容,压缩包里有。
复制代码 代码如下:


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





~/(\d*).html
~/user/default.aspx?link=$1






type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
type="URLRewriter.RewriterFactoryHandler, URLRewriter" />


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. 加入代码:
复制代码 代码如下:


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


C. 如果网站使用通过虚拟主机来定义,请务必加到虚拟主机配置文件.htccess 中去,否则可能
无法使用。
D. 重启Apache,重新载入配置。
E. 在地址栏输入[url]http://localhost/1.html[/url] ,实际指向[url]http://localhost/user.php?user=1[/url]

以上就是aspx文件格式使用URLRewriter实现静态化变成html的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » ASP编程