[英]Response.Redirect() Works in Visual Studio but not IIS
I'm trying to upload a basic web application from visual studio on Windows 7 to an IIS environment on Windows Server 2007. 我正在尝试将基本的Web应用程序从Windows 7上的visual studio上传到Windows Server 2007上的IIS环境。
Though launching it from IIS displays the Login page, trying to navigate past it to the main menu returns this error: 虽然从IIS启动它会显示“登录”页面,但尝试通过它导航到主菜单会返回以下错误:
Server Error in Application "PARKING/PARKING ASSIGNMENTS WEB"Internet Information Services 7.0
Error Summary
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. Detailed Error Information
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Requested URL http://localhost:81/Parking Assignments Web/Home
Physical Path C:\ParkingAssignmentsWeb\Home
Logon Method Anonymous
Logon User Anonymous
Most likely causes:
•The directory or file specified does not exist on the Web server.
•The URL contains a typographical error.
•A custom filter or module, such as URLScan, restricts access to the file.
Things you can try:
•Create the content on the Web server.
•Review the browser URL.
•Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus. For more information about creating a tracing rule for failed requests, click here.
Links and More InformationThis error means that the file or directory does not exist on the server. Create the file or directory and try the request again.
View more information »
This is the code I used for navigation: 这是我用于导航的代码:
Response.Redirect("Home.aspx");
Why would this navigation work on Visual Studio but not on IIS? 为什么这个导航在Visual Studio上工作而在IIS上不工作?
UPDATE: I tried the variations of the Redirect command you guys showed me but all of them gave a 404 error, which leads me to believe that the problem isn't with the command but with something else. 更新:我尝试了你们向我展示的Redirect命令的变体,但是他们都给出了404错误,这让我相信问题不在于命令,而在于其他问题。 Any idea what?
知道什么?
Please try: 请试试:
Response.Redirect("~/Parking Assignments Web/Home.aspx");
or 要么
Response.Redirect("~/Parking Assignments Web/Home");
It treats Home.aspx
as a relative path. 它将
Home.aspx
视为相对路径。
Use it like: 使用它像:
Response.Redirect("/Home.aspx");
when you deploy to IIS a different web server is being used. 当您部署到IIS时,正在使用其他Web服务器。 Visual studio uses a web server with limited options and in most cases but not all an application should run without changes when deployed to IIS on windows server.
Visual Studio使用的Web服务器选项有限,但在大多数情况下,并非所有应用程序在Windows服务器上部署到IIS时都应该运行而不进行更改。
Things to check 要检查的事情
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.