简体   繁体   中英

ASPX Redirect to a file gives error “This page can't be displayed”

I have an ASP.NET web application, that given a URL, retrieves a file and redirects the browser to the retrieved file. The file is in a sub-folder under the web app. OK, simple enough. So I deploy my web app to the web server. When I load the URL in the browser, it executes 100% fine, then redirects the browser - only to see this message in Internet Explorer. Interestingly enough, in Chrome, it opens up a Google search page.

So, if I change the code a bit so that it displays the URL that it would redirect to in the web page instead of redirecting it, then I copy/paste that URL into the address bar - voila, the file comes up. But the Response.Redirect doesn't work.

Now, the web application is set up on IIS as an application, the application pool identity happens to be an administrator on that machine. The subdirectory underneath the application has no special permissions/settings on it.

Has anyone seen this before?

I found the problem. The string that was used to redirect to, was actually returned from a TCP socket connection from a helper service, and was not truncated. It was converted from a Byte array, and thus had the full size of the byte array (zero-filled). Once I truncated it, it works fine.

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