当项目从iis 6.1运行时,asp:按钮单击事件未触发

时间:2014-12-09 17:03:38

标签: vb.net events iis-6 handler aspbutton

当我从visual studio 2012运行一个项目时,我正在使用的asp:按钮正常工作。但是,当我将项目发布到IIS 6.1时,按钮的单击事件处理程序不会被调用。我已将visual studio附加到服务器上的运行进程,并确认回发正在触发但单击处理程序永远不会被调用。

下面是我的web.config以及后面的页面和代码。

Default.aspx的

<%@ Page Language="VB" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="BIR_Injuries._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>
    <link rel="Stylesheet" type="text/css" href="Styles/main.css" />
</head>
<body>
    <form id="form1" runat="server">
    <div id="wrap">
        <div id="divFields" runat="server">
            <hr />
            <telerik:RadTextBox ID="rtb_ID" Visible="false" runat="server"></telerik:RadTextBox>
            <table cellspacing="3" cellpadding="3" border="0">
                <tr>
                    <td valign="top">&nbsp;</td>
                    <td valign="top">
                        <asp:button id="RadButton1" runat="server" text="Submit" AutoPostBack="true" CausesValidation="false" OnClick="RadButton1_Click"></asp:button>
                    </td>
                </tr>
            </table>
        </div>
        <div id="divSent" runat="server">
            <p>Your injury assessment has been submitted. <asp:HyperLink ID="hlSendAnother" runat="server" NavigateUrl="~/Default.aspx" Text="Send another"></asp:HyperLink>.</p>
        </div>
    </div>
    </form>
</body>
</html>

Default.aspx.vb

Imports Telerik.Web.UI
Imports System.Net
Imports System.Net.Mail
Imports System.Data.SqlClient
Imports System.Configuration

Partial Class _Default

    Inherits System.Web.UI.Page

    Public Testing As Boolean = False

    Protected Sub Default_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        divSent.Visible = False
        If Request.QueryString("iid") IsNot Nothing Then
            rtb_ID.Text = Request.QueryString("iid")
        Else
            rtb_ID.Text = Guid.NewGuid.ToString
        End If
        If Testing Then
            rtb_Event.Text = "Test"
            rdp_Date.SelectedDate = "01/01/2001"
            rtb_Email.Text = "email@address.com"
            rtb_RespondingAT.Text = "Responding AT"
        End If
    End Sub


    Protected Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click
        Page.Validate()
    End Sub
End Class

的web.config

<?xml version="1.0"?>
<configuration>
    <configSections>
        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
            <section name="BIR_Injuries.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
        </sectionGroup>
    </configSections>
    <connectionStrings>
    <!--<add name="birinjury" providerName="System.Data.SqlClient" connectionString="Data Source=smcdevprtl01;Initial Catalog=BaylorInjuryForm_Dev;User ID=birinjury;Password=#password#;" />-->
    <add name="birinjury" providerName="System.Data.SqlClient" connectionString="Data Source=10.9.5.111;Initial Catalog=BaylorInjuryForm;User ID=birinjury;Password=#password#;"/>
    </connectionStrings>
    <appSettings>
        <add key="Telerik.Skin" value="WebBlue"/>
        <add key="Telerik.ScriptManager.TelerikCdn" value="Disabled"/>
        <add key="Telerik.StyleSheetManager.TelerikCdn" value="Disabled"/>
        <add key="EmailFrom" value="webmaster@address.com" />
        <add key="EmailCC" value="webmaster@address.com" />
        <add key="EmailTo" value="webmaster@address.com" />
        <add key="SMTPServer" value="172.23.0.71" />
    </appSettings>
    <system.web>
        <customErrors mode="Off"/>
        <compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
        </compilation>
        <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
            <controls>
                <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI"/>
            </controls>
        </pages>
        <httpHandlers>
            <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false"/>
            <add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false"/>
            <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false"/>
            <add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false"/>
            <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false"/>
        </httpHandlers>
        <httpModules>
            <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule"/>
            <add name="RadCompression" type="Telerik.Web.UI.RadCompression"/>
        </httpModules>
        <httpRuntime maxRequestLength="5120" executionTimeout="120"/>
    </system.web>
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <modules runAllManagedModulesForAllRequests="true">
            <remove name="RadUploadModule"/>
            <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" preCondition="integratedMode"/>
            <remove name="RadCompression"/>
            <add name="RadCompression" type="Telerik.Web.UI.RadCompression" preCondition="integratedMode"/>
        </modules>
        <handlers>
            <remove name="ChartImage_axd"/>
            <add name="ChartImage_axd" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" preCondition="integratedMode"/>
            <remove name="Telerik_Web_UI_SpellCheckHandler_axd"/>
            <add name="Telerik_Web_UI_SpellCheckHandler_axd" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" preCondition="integratedMode"/>
            <remove name="Telerik_Web_UI_DialogHandler_aspx"/>
            <add name="Telerik_Web_UI_DialogHandler_aspx" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode"/>
            <remove name="Telerik_RadUploadProgressHandler_ashx"/>
            <add name="Telerik_RadUploadProgressHandler_ashx" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" preCondition="integratedMode"/>
            <remove name="Telerik_Web_UI_WebResource_axd"/>
            <add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode"/>
        </handlers>
        <security>
            <requestFiltering>
                <requestLimits maxAllowedContentLength="5242880"/>
            </requestFiltering>
        </security>
    </system.webServer>
</configuration>

1 个答案:

答案 0 :(得分:0)

我可以推荐两个小东西尝试从按钮中删除AutoPostBack =“true”并为表单提供一个action属性。

如果未设置操作或将其设置为action ='#',IIS 6可能会出现问题