我有一个网站项目工作正常。我已经将它转换为VS 2010中的Web应用程序项目。现在当我从VS启动项目时,我的登录页面永远不会被加载,因为当它尝试加载图像,脚本,css时,所有请求都会重定向回登录页面。
但是如果我在我的本地IIS下设置一个网站来使用该项目所在的文件夹,网站就没有问题。
我创建了一个测试网络应用程序。它的确大致相同。登录页面无法加载图像,因为请求已重定向。 这就是我所拥有的。
的web.config
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms name=".ASPXAUTH" loginUrl="~/login1.aspx" defaultUrl="~/default.aspx" slidingExpiration="true"/>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
<trace enabled="true" pageOutput="true" requestLimit="150" mostRecent="false" />
</system.web>
<location path="trace.axd">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
login1.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="login1.aspx.cs" Inherits="TestWebApp.login1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<img src="bcb.jpeg" />
login page
</div>
</form>
</body>
</html>
的Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="TestWebApp._default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
default page
</div>
</form>
</body>
</html>
,跟踪看起来像
对此申请剩余的请求:140
编号请求时间文件状态代码动词
1 11/30/2010 10:57:20 AM default.aspx 302 GET查看详细信息
2 11/30/2010 10:57:20 AM login1.aspx 200 GET查看详细信息
3 11/30/2010 10:57:22 AM bcb.jpeg 302获取查看详细信息
4 11/30/2010 10:57:22 AM login1.aspx 200 GET查看详细信息
我错过了什么。有什么想法吗?
谢谢
答案 0 :(得分:2)