[英]Click Event not working IIS 7.5
我有一个使用IIS 7.5的经典ASP网站。 我已经在经典的ASP网站内部创建了一个.NET应用程序。 我注意到单击“提交”按钮不会触发事件。 当我调试时它可以工作,仅此而已。 我在下面附上了一些代码。
MASTER PAGE(这称为经典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”语句,这在调试时没有发生。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.