简体   繁体   中英

IIS throwing HTTP 404 not found but resource exists. Requested URL also changing automatically.!

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 " ". ”。 the redirect_url is being formed dynamically and given as a parameter to the method. 方法的参数提供。

While debugging, the final redirect_url that is being sent as parameter to method is: 方法的最终redirect_url是:

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 shown in the error page is different that what was dynamically sent to the method. 与动态发送给 不同。 方法。

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

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

whereas 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.

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.!

Indeed, the problem was with the way I had hosted the sites in my application. I just removed all the sites related to my application from IIS and then hosted all of them again much more carefully. This resolved the "wrong redirect url" problem.

Also, I had some tables with missing required data because of which I was getting the error code.

So after I got all the tables filled with the required data and also after properly hosting the application in IIS, my problem got resolved.

In IIS, go to relevant folder, right click and "browse". Check out what is the URL. In most cases, this is due to the URL should have port number appended. For instance it will be something like :

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

instead of

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM