单击事件不工作IIS 7.5
本文关键字:IIS 工作 事件 单击 | 更新日期: 2023-09-27 17:59:46
我有一个使用IIS 7.5的经典asp网站。我在经典的asp网站中创建了一个.NET应用程序。我注意到点击提交按钮不会触发事件。它在我调试时工作,但仅此而已。我在下面附上了一些代码。
主页(这调用一个经典的asp页面来检查用户是否登录到网站的经典部分)
#if !DEBUG
if (Request.Cookies["sessionInfo"] != null)
{
HttpCookie cookie = Request.Cookies.Get("sessionInfo");
bool temp;
cookie.Name = "sessionInfo";
if (bool.TryParse(cookie["PortalManagement"], out temp))
{
Session["PortalManagement"] = bool.Parse(cookie["PortalManagement"]);
cookie.Expires = DateTime.Now.AddDays(-1);
Response.Cookies.Add(cookie);
Logon();
}
else
{
Response.Redirect(ConfigurationManager.AppSettings["PricingDesk"]);
}
}
else
{
Response.Redirect(String.Format("{0}loginSession.asp?cPage={1}", ConfigurationManager.AppSettings["PricingDesk"], Request.Url.AbsolutePath));
}
#endif
ASPX页面(只是一个按钮)
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:Button ID="btnClick" runat="server" Text="Click" OnClick="btnClick_Click" />
</asp:Content>
背后的代码
protected void btnClick_Click(object sender, EventArgs e)
{
Response.Write("<script language=javascript>alert('ERROR');</script>");
}
WEBCONFIG(.NET站点的)
<configuration>
<appSettings>
<add key="Database" value="Min Pool Size=5;Max Pool Size=40;Connect Timeout=40;Server=<serv>;uid=<username>;pwd=<pass>;database=<db>"/>
<add key="PricingDesk" value="http://address/"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<customErrors mode="Off"></customErrors>
</system.web>
<system.webServer>
<defaultDocument>
<files>
<add value="home.aspx"/>
</files>
</defaultDocument>
</system.webServer>
</configuration>
WEBCONFIG(经典或主网站)
<configuration>
<system.webServer>
<defaultDocument>
<files>
<remove value="default.aspx" />
<remove value="iisstart.htm" />
<remove value="index.html" />
<remove value="index.htm" />
<remove value="Default.asp" />
<remove value="Default.htm" />
<add value="Pricingdesk.asp" />
</files>
</defaultDocument>
<httpErrors errorMode="DetailedLocalOnly" defaultPath="/errorPages/unknownerror.asp" defaultResponseMode="ExecuteURL">
<remove statusCode="401" subStatusCode="-1" />
<remove statusCode="403" subStatusCode="-1" />
<remove statusCode="405" subStatusCode="-1" />
<remove statusCode="406" subStatusCode="-1" />
<remove statusCode="412" subStatusCode="-1" />
<remove statusCode="502" subStatusCode="-1" />
<remove statusCode="501" subStatusCode="-1" />
<remove statusCode="500" subStatusCode="-1" />
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/errorPages/pagenotfound.asp" responseMode="ExecuteURL" />
<error statusCode="412" prefixLanguageFilePath="" path="/errorPages/pagenotfound.asp" responseMode="ExecuteURL" />
<error statusCode="406" prefixLanguageFilePath="" path="/errorPages/pagenotfound.asp" responseMode="ExecuteURL" />
<error statusCode="405" prefixLanguageFilePath="" path="/errorPages/pagenotfound.asp" responseMode="ExecuteURL" />
<error statusCode="403" prefixLanguageFilePath="" path="/errorPages/pagenotfound.asp" responseMode="ExecuteURL" />
<error statusCode="401" prefixLanguageFilePath="" path="/errorPages/pagenotfound.asp" responseMode="ExecuteURL" />
<error statusCode="500" path="/errorPages/unknownerror.asp" responseMode="ExecuteURL" />
<error statusCode="500" subStatusCode="100" path="/errorPages/unknownerror.asp" responseMode="ExecuteURL" />
<error statusCode="501" path="/errorPages/unknownerror.asp" responseMode="ExecuteURL" />
<error statusCode="502" path="/errorPages/unknownerror.asp" responseMode="ExecuteURL" />
</httpErrors></system.webServer>
<system.web>
<compilation batch="true" explicit="false" debug="true" targetFramework="4.0">
</compilation>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" /></system.web>
</configuration>
我一整天都在寻找答案,我希望有比我更聪明的人能找到答案!
提前感谢!
最终这不是IIS问题。这是因为在我的经典ASP页面中,我总是直接返回主页,并且我丢失了QueryString。由于'#if!DEBUG的声明。