本文介绍了IIS找不到HTTP 404,但资源存在。请求的URL也会自动更改。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我的本地IIS面临一个非常奇怪的场景。我在本地IIS的默认网站上托管了多个网站。其中一个有登录页面。从登录页面,我将用户重定向到位于另一个站点的另一个页面(也在默认网站虚拟目录中的同一个IIS中)。



现在,在我的登录页面的提交按钮单击事件中,在对用户进行身份验证后,我写了一个 Response.Redirect( redirect_url redirect_url 正在动态形成,并作为参数提供给 Redirect 方法。



调试时,最终 redirect_url 作为参数发送到 Redirect 方法是:



http:// localhost / CP /web/console/console.aspx?sk=3e3cc1a8-73c4-4945-b3f8-08af22ea4324.50008





但是在我尝试之后进入下一步,我突然收到HTTP 404错误,说资源不存在,我发现错误页面中显示 请求的URL 是什么动态发送到 Response.Redirect(...)方法。



在错误页面中,请求网址显示值为



http:// localhost / CP / web / console / localhost / CPLogin?err = 5



而代码中形成的 我实际要求的网址 是:



http://localhost/CP/web/console/console.aspx ?sk = 3e3cc1a8-73c4-4945-b3f8-08af22ea4324.50008



我只是无法理解为什么请求的网址会自动更改。此外,我观察到localhost被再次附加到请求的URL,这不应该发生。



[]以更清楚地理解这个问题。我添加了错误页面的屏幕截图以及我的代码片段。





[]



非常感谢。!

Hi all,

I'm facing a really weird scenario here with my local IIS. I have hosted multiple sites in the default website in my local IIS. One of them has the login page. From the login page, I'm redirecting the user to another page that is located in another site (which is also hosted in the same IIS inside default website virtual directory).

Now in the submit button click event of my login page, after authenticating the user, I have written a "Response.Redirect(redirect_url)". the redirect_url is being formed dynamically and given as a parameter to the Redirect method.

While debugging, the final redirect_url that is being sent as parameter to Redirect method is:

http://localhost/CP/web/console/console.aspx?sk=3e3cc1a8-73c4-4945-b3f8-08af22ea4324.50008


But after I try to go to the next step, I'm suddenly getting a HTTP 404 error saying that the resource doesn't exist and I have observed that Requested URL shown in the error page is different that what was dynamically sent to the Response.Redirect(...) method.

In the error page, the requested url shows the value as

http://localhost/CP/web/console/localhost/CPLogin?err=5

whereas my actual requested url formed in the code is:

http://localhost/CP/web/console/console.aspx?sk=3e3cc1a8-73c4-4945-b3f8-08af22ea4324.50008

I'm just unable to understand why the requested url is getting changed automatically.! Also, I observe that "localhost" is being appended to the requested URL again which is not what is supposed to happen.

Please visit THIS link[^] to understand this question more clearly. I have added screen shot of the error page and also my code snippets.


http://amoghnatu.wordpress.com/2013/09/16/question-please-help-iis-throwing-http-404-not-found-but-requested-resource-actually-exists-requested-url-also-changing-automatically/[^]

Thanks a lot.!

推荐答案




这篇关于IIS找不到HTTP 404,但资源存在。请求的URL也会自动更改。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 14:25