簡體   English   中英

單擊事件不起作用IIS 7.5

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM