我希望有人可以帮助我了解我正在做的这个噩梦......!
我刚刚在 Apress 书籍的帮助下完成了一个 ASP.Net 电子商务网站;BalloonShop 项目,你们中的一些人可能已经知道了。
除了我看不到要解决的一个小问题之外,一切都很好而且花花公子!
我无法从 URL 中没有 .aspx 扩展名的任何页面使用 asp.net 登录控件从我的站点注销。这就是; 部门、类别和产品使用 Intelligencia.UrlRewriter 来提供浏览器友好的 url。
我的 url 被完美重写,但是当我尝试从使用 url 重写器的页面注销时,它不起作用,并且我在错误日志电子邮件中收到以下消息:
Exception generated on 22 February 2013, at 22:23
Page location: /Triple-x/Dynamo-p4/?
<div id=":143">ProductId=4
Message: The HTTP verb POST used to access path '/Triple-x/Dynamo-p4/' is not allowed.
Source: System.Web
Method: System.IAsyncResult BeginProcessRequest(System.Web.HttpContext, System.AsyncCallback, System.Object)
Stack Trace:
at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionSt ep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)</div>
在我的 web.config 中,如果有:
<configSections>
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler,Intelligencia.UrlRewriter" />
</configSections>
<rewriter>
<!-- Rewrite department pages -->
<rewrite url="^.*-d([0-9]+)/?$" to="~/Catalog.aspx?DepartmentID=$1" processing="stop" />
<rewrite url="^.*-d([0-9]+)/page-([0-9]+)/?$" to="~/Catalog.aspx?DepartmentID=$1&Page=$2" processing="stop" />
<!-- Rewrite category pages -->
<rewrite url="^.*-d([0-9]+)/.*-c([0-9]+)/?$" to="~/Catalog.aspx?DepartmentId=$1&CategoryId=$2" processing="stop" />
<rewrite url="^.*-d([0-9]+)/.*-c([0-9]+)/page-([0-9]+)/?$" to="~/Catalog.aspx?DepartmentId=$1&CategoryId=$2&Page=$3" processing="stop" />
<!-- Rewrite product details pages -->
<rewrite url="^.*-p([0-9]+)/?$" to="~/Product.aspx?ProductId=$1" processing="stop" />
</rewriter>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" />
<remove name="ScriptModule" />
<!--<add name="ScriptModule" preCondition="managedHandler" />-->
</modules>
</system.webServer>
我也在我的本地机器上使用 IIS7,并且已经读到这有时可能是原因:AppPool 版本。我已尝试按照建议将其更改为 Classic ASP,但这对我不起作用!
有谁知道这是否是在本地计算机上托管和使用 Intelligencia.UrlRewriter 时的常见问题?如果托管在共享网络托管服务器上,这可能不是问题吗?
如果我离题了,请原谅我的幼稚,因为我对此还是很陌生,尤其是这种规模的项目。
谢谢你的帮助!!