PDA

View Full Version : Muốn bỏ rewrite cho website



thanhtamntp
24-12-2013, 10:15
Hiện mình có site bị lỗi rewrite trên windows 2k3 trên 2k8 thì bình thường.
Nhưng 1 số lý do không chạy được trên 2k8 nên cần bỏ phần config rewrite để chạy trên 2k3

Đây là file web.config


<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectio nGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHa ndlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSecti onGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializatio nSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSe ction, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationSe rviceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
<section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic" allowDefinition="MachineToApplication" restartOnExternalChanges="true" requirePermission="false" />
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterCo nfigurationSectionHandler, Intelligencia.UrlRewriter" />
</configSections>

<rewriter>

<rewrite url="/(.+)/(.+)/documentdownload.html" to="/Web/gami_document.aspx?lang=$1&amp;projectid=$2" processing="stop"/>

<!--Gửi cho bạn bè-->
<rewrite url="/(.+)/(.+)/sendemail.html" to="/Web/SendEmail.aspx?lang=$1&amp;url=$2" processing="stop"/>

<rewrite url="/(.+)/(.+)/print.html" to="/Web/Print.aspx?lang=$1&amp;newsid=$2" processing="stop"/>


<rewrite url="/(.+)/Default.html" to="/Web/Default.aspx?lang=$1" processing="stop"/>
<rewrite url="/(.+)/(.+)/.html" to="/Web/Default.aspx?lang=$1&amp;zonename=$2" processing="stop"/>
<rewrite url="/Default.html" to="/Web/Default.aspx" processing="stop"/>
<!--Link đến giỏ hàng-->
<rewrite url="/giohang/ecomviet.html" to="/Web/View.aspx" processing="stop" />
<rewrite url="/(.+)/(.+)/(.+)/(.+)/(.+)/ecomviet.html" to="/Web/View.aspx?lang=$1&amp;zonename=$2&amp;subzonename=$3&amp;subzo nename_un=$4&amp;subzonename_uns=$5" processing="stop" />
<rewrite url="/(.+)/(.+)/(.+)/(.+)/ecomviet.html" to="/Web/View.aspx?lang=$1&amp;zonename=$2&amp;subzonename=$3&amp;subzo nename_un=$4" processing="stop" />
<rewrite url="/(.+)/(.+)/(.+)/ecomviet.html" to="/Web/View.aspx?lang=$1&amp;zonename=$2&amp;subzonename=$3" processing="stop" />
<rewrite url="/(.+)/(.+)/ecomviet.html" to="/Web/View.aspx?lang=$1&amp;zonename=$2" processing="stop" />
<rewrite url="/(.+)/(.+)/(.+)/(.+)/(.+)/(.+).html" to="/Web/View.aspx?lang=$1&amp;zonename=$2&amp;subzonename=$3&amp;subzo nename_un=$4&amp;subzonename_uns=$5&amp;newsname=$6" processing="stop" />
<rewrite url="/(.+)/(.+)/(.+)/(.+)/(.+).html" to="/Web/View.aspx?lang=$1&amp;zonename=$2&amp;subzonename=$3&amp;subzo nename_un=$4&amp;newsname=$5" processing="stop" />
<rewrite url="/(.+)/(.+)/(.+)/(.+).html" to="/Web/View.aspx?lang=$1&amp;zonename=$2&amp;subzonename=$3&amp;newsn ame=$4" processing="stop" />
<rewrite url="/(.+)/(.+)/(.+).html" to="/Web/View.aspx?lang=$1&amp;zonename=$2&amp;newsname=$3" processing="stop" />
<rewrite url="/(.+)/(.+).html" to="/Web/View.aspx?lang=$1&amp;newsname=$2" processing="stop" />




</rewriter>

<appSettings>


<add key="ConnectionString" value="...." />


<add key="Default_Language" value="vi-VN" />
<add key="Default_Language_Website" value="vi-VN" />
<add key="ControlNameDetail" value="detail" />
<add key="UploadPath" value="/Upload/" />
<!--Thiết lập hiển thì trọng tài trong nước hay nước ngoài-->
<add key="Get_Default_Arbitrator" value="vn" />
<add key="Get_Default_Arbitrator_US" value="vn" />
<add key="backupPath" value="/Administrator/backupPath/" />
<add key="downloadpath" value="/Administrator/downloadPath/" />
<add key="databasename" value="piac" />
<add key="fileOriName" value="backup_ db_piac.bak" />
<add key="UploadProduct" value="/Upload/Products/" />
<add key="ControlNameLawDatabase" value="DocumentList" />
<!--Thoi gian trong Cache-->
<add key="CacheExpire" value="3" />
</appSettings>
<connectionStrings>

</connectionStrings>
<system.webServer>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated" />

<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.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=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
<add name="Telerik_Web_UI_DialogHandler_aspx" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" />
<add name="Telerik_Web_UI_SpellCheckHandler_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" />
<add name="Telerik.Web.UI.DialogHandler" path="Telerik.Web.UI.DialogHandler.aspx" verb="*" type="Telerik.Web.UI.DialogHandler, Telerik.Web.UI" />
</handlers>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
<system.web>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" />
<add tagPrefix="ext" namespace="Coolite.Ext.Web" assembly="Coolite.Ext.Web" />
</controls>
</pages>
<customErrors mode="Off" />
<compilation debug="true">
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Drawing.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<!--<add assembly="Telerik.Charting, Version=2.0.4.0, Culture=neutral, PublicKeyToken=D14F3DCC8E3E8763"/>-->
</assemblies>
</compilation>
<httpHandlers>
<remove path="*.asmx" verb="*" />
<add path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
<add path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
<add path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
<add path="*/coolite.axd" verb="*" type="Coolite.Ext.Web.ResourceManager" validate="false" />
<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
<add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" />
<add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false" />
</httpHandlers>
<authentication mode="Forms">
<forms name=".ASPXAUTH" path="/" timeout="30">
</forms>
</authentication>
<trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
<httpModules>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
<add name="HttpModule" type="TimeUniversal.Library.HttpModule, TimeUniversal.Library" />
</httpModules>
<xhtmlConformance mode="Transitional" />
</system.web>
</configuration>

dxt49
24-12-2013, 23:23
Bạn cần làm 2 thao tác

1. Thay đổi các link về đúng link chưa rewrite
2. Bỏ rewrite config được lưu trong file web.config

thanhtamntp
25-12-2013, 08:30
Bạn cần làm 2 thao tác

1. Thay đổi các link về đúng link chưa rewrite
2. Bỏ rewrite config được lưu trong file web.config

Bác có thể hướng dẫn qua theo file web.config ở trên không.

Thật sự là về lập trình mình mù tịt.

Than Dieu
25-12-2013, 17:23
Tùy theo phần lập trình như thế nào mới bỏ được bạn ah. Mình nghĩ là bạn cài đặt thiếu nên không chạy được.

Bạn có thể tham khảo một số link sau xem:
Rewrite URL trong ASP.NET 4.0 bằng Routing (http://diendan.congdongcviet.com/showthread.php?t=183375)
Cách rewrite url động trong asp.net mvc 3 (http://diendan.congdongcviet.com/showthread.php?t=186444)

Bạn nên hỏi ở diễn đàn chuyên lập trình C# (http://diendan.congdongcviet.com/forumdisplay.php?f=9) sẽ tốt hơn

milanplaza
25-12-2013, 18:51
Gửi cả source lên mới sửa được chứ

thanhtamntp
26-12-2013, 10:54
Tùy theo phần lập trình như thế nào mới bỏ được bạn ah. Mình nghĩ là bạn cài đặt thiếu nên không chạy được.

Bạn có thể tham khảo một số link sau xem:
Rewrite URL trong ASP.NET 4.0 bằng Routing (http://diendan.congdongcviet.com/showthread.php?t=183375)
Cách rewrite url động trong asp.net mvc 3 (http://diendan.congdongcviet.com/showthread.php?t=186444)

Bạn nên hỏi ở diễn đàn chuyên lập trình C# (http://diendan.congdongcviet.com/forumdisplay.php?f=9) sẽ tốt hơn

Có thể rewrite họ viết cho IIS 7 nên vẫn chạy được trên 2k8, 2k3 thì bị lỗi rewrite.

Ở trên 2k8 thì nó bị lỗi Telerik khi up ảnh

http://imageshack.us/a/img89/2677/clqj.png

thanhtamntp
27-12-2013, 11:55
Hiện mình đã fix được lỗi trên 2k8. Nên không cần bỏ rewrite để chạy trên 2k3 nữa :D