asp.net怎么配置伪静态啊,在网上看了不少,不过还是不知道怎么用 如题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在IIS里面配置。其实配置方式都是千篇一律。都是一样的。加载一个dll让他伪装如果楼主实在不会配置或者配置坏了导致 服务器上的所有网站崩溃建议 用代码把自己的页面静态 <RewriterConfig> <Rules> <RewriterRule> <LookFor>~/index.html</LookFor> <SendTo>~/Dome.aspx</SendTo> </RewriterRule> </Rules> </RewriterConfig>配置文件这样的、 具体请 谷歌 <!--伪静态开始--> <configSections> <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/> </configSections> <RewriterConfig> <Rules> <RewriterRule> <LookFor>~/([^_]+)_?([^/_]*)_?([^/_]*)_?([^/_]*)\.html</LookFor> <SendTo><![CDATA[~/$1.aspx?key1=$2&key2=$3&key3=$4]]></SendTo> </RewriterRule> </Rules> </RewriterConfig> <!--伪静态结束--> IIS6URLRewriter.dllwebconfig <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/> <RewriterRule> <LookFor>/index.html</LookFor> <SendTo>/index.aspx</SendTo> </RewriterRule>IIS7使用 url rewrite 进行配置 在webconfig已经配置过了不过不知道怎么用求解啊 用法很简单地址栏把aspx改成html就行了一般是你webconfig没配对我给你传个webconfig文件 你看看配的对了么? 这是我的<?xml version="1.0"?><!-- 注意: 除了手动编辑此文件以外,您还可以使用 Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的 “网站”->“Asp.Net 配置”选项。 设置和注释的完整列表在 machine.config.comments 中,该文件通常位于 \Windows\Microsoft.Net\Framework\v2.x\Config 中--><configuration> <configSections> <section name="RewriterConfig" requirePermission="false" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" /> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/> <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> </sectionGroup> </sectionGroup> </sectionGroup> </configSections> <appSettings> <add key="FCKeditor:BasePath" value="/Web/ckeditor/" /> <add key="mystr" value="Data Source=XP-201104061732;Initial Catalog=MyWeb;user id=sa;pwd=mypassword"/> </appSettings> <connectionStrings> <add name="mystr" connectionString="Data Source=XP-201104061732;Initial Catalog=MyWeb;Integrated Security=True"/> </connectionStrings> <RewriterConfig> <Rules> <RewriterRule> <LookFor>~/cn/ss_(.[\d]*)\.html</LookFor> <SendTo>~/cn/news.aspx?id=$1</SendTo> </RewriterRule> <RewriterRule> <LookFor>~/cn/ss_(.[\d]*)0(.[\w]*).html</LookFor> <!--(.[\d]*)(.[\w]*).html 或者 ss_,(.[0-9]*),(.[0-9]*)\.html--> <SendTo><![CDATA[~/cn/news.aspx?id=$1&sid=$2]]></SendTo> </RewriterRule> <RewriterRule> <!--三个参数--> <LookFor>~/cn/ss_(.[\d]*)0(.[\w]*)0(.[\w]*).html</LookFor> <SendTo><![CDATA[~/ZH-CN/news.aspx?id=$1&sid=$2&n_id=$3]]></SendTo> </RewriterRule> </Rules> </RewriterConfig> <system.web> <!-- 设置 compilation debug="true" 可将调试符号插入 已编译的页面中。但由于这会 影响性能,因此只在开发过程中将此值 设置为 true。 --> <compilation debug="true"> <assemblies> <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> </assemblies> </compilation> <!-- 通过 <authentication> 节可以配置 ASP.NET 用来 识别进入用户的 安全身份验证模式。 --> <authentication mode="Windows"/> <!-- 如果在执行请求的过程中出现未处理的错误, 则通过 <customErrors> 节可以配置相应的处理步骤。具体说来, 开发人员通过该节可以配置 要显示的 html 错误页 以代替错误堆栈跟踪。 <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> --> <pages> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </controls> </pages> <httpHandlers> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> <add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" /> <add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" /> </httpHandlers> <httpModules> <add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter"/> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </httpModules> </system.web> <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <providerOption name="CompilerVersion" value="v3.5"/> <providerOption name="WarnAsError" value="false"/> </compiler> <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <providerOption name="CompilerVersion" value="v3.5"/> <providerOption name="OptionInfer" value="true"/> <providerOption name="WarnAsError" value="false"/> </compiler> </compilers> </system.codedom> <!-- 在 Internet 信息服务 7.0 下运行 ASP.NET AJAX 需要 system.webServer 节。对早期版本的 IIS 来说则不需要此节。 --> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules> <remove name="ScriptModule"/> <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </modules> <handlers> <remove name="WebServiceHandlerFactory-Integrated"/> <remove name="ScriptHandlerFactory"/> <remove name="ScriptHandlerFactoryAppServices"/> <remove name="ScriptResource"/> <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </handlers> </system.webServer> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> </dependentAssembly> </assemblyBinding> </runtime></configuration> 账号 密码都贴出来了该有的都有了 只是多了一个属性 requirePermission 我这没有 去掉试试 URL无参 <RewriterConfig> <Rules> <RewriterRule> <LookFor>~/myaccount.html</LookFor> <SendTo>~/myaccount.aspx</SendTo> </RewriterRule></Rules></RewriterConfig>URl有参<RewriterRule> <LookFor>~/product_list-([_a-zA-Z0-9-]*)-c_(\d+)\.html</LookFor> <SendTo>~/product_list.aspx?sort_name=$1&sort_id=$2</SendTo> </RewriterRule> 在Web.config配置。超链接直接href静态地址就O了 可以在vs2008中自己查看吗?还是要发布到iis中才行 对了,如果网站发布,IIS也要配置,添加一个扩展名映射。 现在已经可以用了不过如果要把def.aspx?id=xx%cl=xy$p=xz配置为一个静态的呢比如def_xx_xy_xx.html呢正则怎么写呢? <RewriterConfig> <Rules> <RewriterRule> <LookFor>~/index.html</LookFor> <SendTo>~/index.aspx</SendTo> </RewriterRule> <RewriterRule> <LookFor>~/forum/(\d{0,8})/(\w{0,9})\.html</LookFor> <SendTo>~/tiezilist.aspx?id=$1&page=$2</SendTo> </RewriterRule> <RewriterRule> <LookFor>~/User/(\d{0,8}).html</LookFor> <SendTo>~/UserInfo.aspx?id=$1</SendTo> </RewriterRule> <RewriterRule> <LookFor>~/UserForums/(\d{0,8})/(\w{0,9})\.html</LookFor> <SendTo>~/MyForum_Info.aspx?id=$1&page=$2</SendTo> </RewriterRule> <RewriterRule> <LookFor>~/forumView/([A-Fa-f0-9]{8}(-[A-Fa-f0-9]{4}){3}-[A-Fa-f0-9]{12})/(\w{0,9})\.html</LookFor> <SendTo>~/TieZiView.aspx?id=$1&page=$3</SendTo> </RewriterRule> </Rules> </RewriterConfig> 谢谢你的回答啊不过这个正则有看不懂哦呵呵可以加一点注释吗比如把a.aspx?id=1&id2=2&id3=3,a.aspx&id=1&id2=2,a.aspx?id=1生成了什么文件名 (\d{0,8}) 数字(\w{0,9}) 数字 字母 汉字([A-Fa-f0-9]{8}(-[A-Fa-f0-9]{4}){3}-[A-Fa-f0-9]{12})/(\w{0,9})这个是匹配guid 还是有点看不懂哦我的意思是如果把a.aspx?id=xxx1&id2=xxx2&id3=xxx3按正则生成以后会是什么样的文件名呢?比如用<RewriterRule> <LookFor>~/UserForums/(\d{0,8})/(\w{0,9})\.html</LookFor> <SendTo>~/MyForum_Info.aspx?id=$1&page=$2</SendTo> </RewriterRule>生成后的文件名是什么样的呢? /product/productlist.aspx?cl=cr&pcr=0这个会生成什么呢用<LookFor>~/UserForums/(\d{0,8})/(\w{0,9})\.html</LookFor> <SendTo>~/MyForum_Info.aspx?id=$1&page=$2</SendTo>的话要怎么写呢会生成什么样的名称呢?先谢谢啊 <LookFor>~/productlist/(\w{0,9})/(\d{0,8})\.html</LookFor><SendTo>~/product/productlist.aspx?cl=$1&pcr=$2</SendTo>我要回家了,其他的自己试一下就都明白了 还是有点不行啊我的路径是这样的http://localhost:4330/Web/product/productlist.aspx?cl=cr&pcr=1请问下正则该怎么写啊还有http://localhost:4330/Web/product/productlist.aspx?cl=cr&pcr=1&p=1又该怎么写啊拜托各位了 还有http://localhost:4330/Web/product/productlist.aspx?id=2上面的cl=cr(cr不是数字)还有生成后的名称是上面呢小弟不太懂正则表达式啊麻烦各位了 直接在vs中打开不行么不是要在vs测试好以后才发布到iis测试么?谢谢你的回复啊 哪位帮忙写一下啊感激不尽啊网上的那些正则不知道重写后的url是多少啊再次感谢各位的回复 /product/productlist.aspx?cl=cr&pcr=1&p=1~/productlist/(\w{0,9})/(\d{0,8})/(\d{0,8})\.html~/product/productlist.aspx?cl=$1&pcr=$2&p=$3/product/productlist.aspx?cl=cr&pcr=1~/productlist/(\w{0,9})/(\d{0,8})\.html~/product/productlist.aspx?cl=$1&pcr=$2/product/productlist.aspx?id=2~/productlist/(\d{0,8})\.html~/product/productlist.aspx?id=$1 你试试吧 应该是这样 我猜的~~ <LookFor>~/products/(\d{0,8})\.html</LookFor><SendTo>~/product/products.aspx?id=$1</SendTo>http://localhost:4330/Web/product/products.aspx?id=15重写后的url是http://localhost:4330/Web/product/products/15.html么怎么不行呢? <LookFor>~/Default.html</LookFor> <SendTo>~/Default.aspx</SendTo>http://localhost:4330/Web/Default.aspx写成http://localhost:4330/Web/Default.html都可以啊vs的问题么?不好意思可能我的问题比较多 ,呵呵 writeurl,网上现成的例子很多的 结合各位回复的终于解决了谢谢各位啊特别是cxs861226一直耐心回复谢谢啊 谁有ip地址数据库啊——csdn第二贴 大家讨论一下在专业软件公司和一般公司搞开发差别 帮忙解决一个思路问题 asp.net 对数据库批量添 删 改 用什么操作好? discuz开源论坛asp.net部署 网站首页被挂码,现在束手无策,高手帮助 最优剩余计算 找不到文件或程序集名称“sso52ew7”,或找不到它的一个依赖项。 总之是关于类的问题====简单 .net如何避免各种版本报错问题 关于asp.net操作数据库,用哪些方式在页面显示操作的数据结果 多行多列输入数据
如果楼主实在不会配置或者配置坏了导致 服务器上的所有网站崩溃建议 用代码把自己的页面静态
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>~/index.html</LookFor>
<SendTo>~/Dome.aspx</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>配置文件这样的、
具体请 谷歌
<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/>
</configSections>
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>~/([^_]+)_?([^/_]*)_?([^/_]*)_?([^/_]*)\.html</LookFor>
<SendTo><![CDATA[~/$1.aspx?key1=$2&key2=$3&key3=$4]]></SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
<!--伪静态结束-->
URLRewriter.dll
webconfig
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/>
<RewriterRule>
<LookFor>/index.html</LookFor>
<SendTo>/index.aspx</SendTo>
</RewriterRule>
IIS7
使用 url rewrite 进行配置
已经配置过了
不过不知道怎么用
求解啊
一般是你webconfig没配对
我给你传个webconfig文件 你看看配的对了么?
<?xml version="1.0"?>
<!--
注意: 除了手动编辑此文件以外,您还可以使用
Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
“网站”->“Asp.Net 配置”选项。
设置和注释的完整列表在
machine.config.comments 中,该文件通常位于
\Windows\Microsoft.Net\Framework\v2.x\Config 中
-->
<configuration>
<configSections>
<section name="RewriterConfig" requirePermission="false" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<appSettings>
<add key="FCKeditor:BasePath" value="/Web/ckeditor/" />
<add key="mystr" value="Data Source=XP-201104061732;Initial Catalog=MyWeb;user id=sa;pwd=mypassword"/>
</appSettings>
<connectionStrings>
<add name="mystr" connectionString="Data Source=XP-201104061732;Initial Catalog=MyWeb;Integrated Security=True"/>
</connectionStrings>
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>~/cn/ss_(.[\d]*)\.html</LookFor>
<SendTo>~/cn/news.aspx?id=$1</SendTo>
</RewriterRule> <RewriterRule>
<LookFor>~/cn/ss_(.[\d]*)0(.[\w]*).html</LookFor>
<!--(.[\d]*)(.[\w]*).html 或者 ss_,(.[0-9]*),(.[0-9]*)\.html-->
<SendTo><![CDATA[~/cn/news.aspx?id=$1&sid=$2]]></SendTo>
</RewriterRule>
<RewriterRule>
<!--三个参数-->
<LookFor>~/cn/ss_(.[\d]*)0(.[\w]*)0(.[\w]*).html</LookFor>
<SendTo><![CDATA[~/ZH-CN/news.aspx?id=$1&sid=$2&n_id=$3]]></SendTo>
</RewriterRule> </Rules>
</RewriterConfig> <system.web>
<!--
设置 compilation debug="true" 可将调试符号插入
已编译的页面中。但由于这会
影响性能,因此只在开发过程中将此值
设置为 true。
-->
<compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<!--
通过 <authentication> 节可以配置 ASP.NET 用来
识别进入用户的
安全身份验证模式。
-->
<authentication mode="Windows"/>
<!--
如果在执行请求的过程中出现未处理的错误,
则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
开发人员通过该节可以配置
要显示的 html 错误页
以代替错误堆栈跟踪。 <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
<add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
<add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
</httpHandlers>
<httpModules>
<add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter"/>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
<!--
在 Internet 信息服务 7.0 下运行 ASP.NET AJAX 需要 system.webServer
节。对早期版本的 IIS 来说则不需要此节。
-->
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="ScriptModule"/>
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
<remove name="ScriptResource"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
该有的都有了 只是多了一个属性 requirePermission 我这没有 去掉试试
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>~/myaccount.html</LookFor>
<SendTo>~/myaccount.aspx</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
URl有参<RewriterRule>
<LookFor>~/product_list-([_a-zA-Z0-9-]*)-c_(\d+)\.html</LookFor>
<SendTo>~/product_list.aspx?sort_name=$1&sort_id=$2</SendTo>
</RewriterRule>
不过如果要把
def.aspx?id=xx%cl=xy$p=xz
配置为一个静态的呢
比如def_xx_xy_xx.html呢
正则怎么写呢?
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>~/index.html</LookFor>
<SendTo>~/index.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/forum/(\d{0,8})/(\w{0,9})\.html</LookFor>
<SendTo>~/tiezilist.aspx?id=$1&page=$2</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/User/(\d{0,8}).html</LookFor>
<SendTo>~/UserInfo.aspx?id=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/UserForums/(\d{0,8})/(\w{0,9})\.html</LookFor>
<SendTo>~/MyForum_Info.aspx?id=$1&page=$2</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/forumView/([A-Fa-f0-9]{8}(-[A-Fa-f0-9]{4}){3}-[A-Fa-f0-9]{12})/(\w{0,9})\.html</LookFor>
<SendTo>~/TieZiView.aspx?id=$1&page=$3</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
不过这个正则有看不懂哦
呵呵
可以加一点注释吗
比如把a.aspx?id=1&id2=2&id3=3,a.aspx&id=1&id2=2,a.aspx?id=1
生成了什么文件名
(\w{0,9}) 数字 字母 汉字
([A-Fa-f0-9]{8}(-[A-Fa-f0-9]{4}){3}-[A-Fa-f0-9]{12})/(\w{0,9})这个是匹配guid
我的意思是如果把a.aspx?id=xxx1&id2=xxx2&id3=xxx3
按正则生成以后会是什么样的文件名呢?
比如用
<RewriterRule>
<LookFor>~/UserForums/(\d{0,8})/(\w{0,9})\.html</LookFor>
<SendTo>~/MyForum_Info.aspx?id=$1&page=$2</SendTo>
</RewriterRule>
生成后的文件名是什么样的呢?
这个会生成什么呢
用<LookFor>~/UserForums/(\d{0,8})/(\w{0,9})\.html</LookFor>
<SendTo>~/MyForum_Info.aspx?id=$1&page=$2</SendTo>
的话要怎么写呢
会生成什么样的名称呢?
先谢谢啊
<SendTo>~/product/productlist.aspx?cl=$1&pcr=$2</SendTo>
我要回家了,其他的自己试一下就都明白了
我的路径是这样的http://localhost:4330/Web/product/productlist.aspx?cl=cr&pcr=1
请问下正则该怎么写啊
还有http://localhost:4330/Web/product/productlist.aspx?cl=cr&pcr=1&p=1
又该怎么写啊
拜托各位了
上面的cl=cr(cr不是数字)
还有生成后的名称是上面呢
小弟不太懂正则表达式啊
麻烦各位了
不是要在vs测试好以后才发布到iis测试么?
谢谢你的回复啊
感激不尽啊
网上的那些正则不知道重写后的url是多少啊
再次感谢各位的回复
/product/productlist.aspx?cl=cr&pcr=1&p=1
~/productlist/(\w{0,9})/(\d{0,8})/(\d{0,8})\.html
~/product/productlist.aspx?cl=$1&pcr=$2&p=$3/product/productlist.aspx?cl=cr&pcr=1
~/productlist/(\w{0,9})/(\d{0,8})\.html
~/product/productlist.aspx?cl=$1&pcr=$2/product/productlist.aspx?id=2
~/productlist/(\d{0,8})\.html
~/product/productlist.aspx?id=$1 你试试吧 应该是这样 我猜的~~
<SendTo>~/product/products.aspx?id=$1</SendTo>
http://localhost:4330/Web/product/products.aspx?id=15
重写后的url是http://localhost:4330/Web/product/products/15.html么
怎么不行呢?
<SendTo>~/Default.aspx</SendTo>
http://localhost:4330/Web/Default.aspx
写成http://localhost:4330/Web/Default.html
都可以啊
vs的问题么?
不好意思可能我的问题比较多 ,呵呵
谢谢各位啊
特别是cxs861226一直耐心回复
谢谢啊