Azure上未触发按钮事件代码隐藏

Azure上未触发按钮事件代码隐藏,azure,azure-table-storage,azure-web-app-service,Azure,Azure Table Storage,Azure Web App Service,我有一个相当简单的单页web应用程序,我已经在本地进行了全面测试。此应用程序是一个简单的表单提交,数据存储在Azure表存储容器中。我为提交按钮提供了一个代码隐藏功能,在该按钮中,我通过弹出窗口中显示的消息执行服务器端验证 在我的本地机器上一切正常,包括所有数据存储和返回Azure的检索。一旦我将网站发布到Azure,隐藏的代码将不会触发,并且我不会在网站本身中得到任何错误。有什么想法吗 布莱恩 请参阅以下所有代码: <form id="form1" runat="server">

我有一个相当简单的单页web应用程序,我已经在本地进行了全面测试。此应用程序是一个简单的表单提交,数据存储在Azure表存储容器中。我为提交按钮提供了一个代码隐藏功能,在该按钮中,我通过弹出窗口中显示的消息执行服务器端验证

在我的本地机器上一切正常,包括所有数据存储和返回Azure的检索。一旦我将网站发布到Azure,隐藏的代码将不会触发,并且我不会在网站本身中得到任何错误。有什么想法吗

布莱恩

请参阅以下所有代码:

<form id="form1" runat="server">
    <telerik:RadWindowManager ID="DefaultWindowMgr" runat="server"></telerik:RadWindowManager>
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>

    <div id="main" style="width:1024px; height:650px; margin-left:auto; margin-right:auto; background-image:url(../Images/earthBG.png);">
        <div id="left" style="width:500px;float:left;left:5px;margin-left:auto;margin-right:auto;">
            <asp:Image ID="Image1" runat="server" ImageAlign="Middle" ImageUrl="~/Images/TRACLogo.png" />
            <asp:Image ID="Image2" runat="server" ImageUrl="~/Images/dashboardGlobe.png" ImageAlign="Middle" />
        </div>
        <div id="right" style="width:500px;float:right;top:75px;position:relative;">
            <p>Some kind of Welcome Text needs to go here.</p>
            <table id="RiskFormTable" style="width:100%;padding:5px;">
                <tr>
                    <td style="text-align:right"><asp:Label ID="LblCompany" runat="server" Text="Company Name:"></asp:Label></td>
                    <td style="text-align:left"><telerik:RadTextBox ID="TxtCompany" runat="server" Width="220px"></telerik:RadTextBox></td>
                </tr>
                <tr>
                    <td style="text-align:right"><asp:Label ID="LblEmail" runat="server" Text="Email Address of POC:"></asp:Label></td>
                    <td style="text-align:left"><telerik:RadTextBox ID="TxtEmail" runat="server" Width="220px"></telerik:RadTextBox></td>
                </tr>
                <tr>
                    <td style="text-align:right"><asp:Label ID="LblCountries" runat="server" Text="What countries do you do business in?"></asp:Label></td>
                    <td style="text-align:left">
                        <telerik:RadListBox ID="LstCountries" runat="server" DataSortField="name" DataSourceID="XMLCountriesSource" DataTextField="name" DataValueField="score" Height="118px" SelectionMode="Multiple" Sort="Ascending" Width="220px" CausesValidation="False"></telerik:RadListBox>
                    </td>
                </tr>
                <tr>
                    <td style="text-align:right"><asp:Label ID="LblPrimary" runat="server" Text="What is your primary customer segment?"></asp:Label></td>
                    <td style="text-align:left">
                        <telerik:RadComboBox ID="DDLPrimary" runat="server" Width="220px" DataSourceID="XMLSegmentsSource" DataTextField="name" DataValueField="value" CausesValidation="False"></telerik:RadComboBox>
                    </td>
                </tr>
                <tr>
                    <td style="text-align:right"><asp:Label ID="LblSecondary" runat="server" Text="What is your secondary customer segment?"></asp:Label></td>
                    <td style="text-align:left">
                        <telerik:RadComboBox ID="DDLSecondary" runat="server" Width="220px" DataSourceID="XMLSegmentsSource" DataTextField="name" DataValueField="value" CausesValidation="False"></telerik:RadComboBox>
                    </td>
                </tr>
                <tr>
                    <td style="text-align:right" colspan="2">
                        <telerik:RadButton ID="BtnSubmit" runat="server" Text="Submit" SingleClick="true" OnClick="BtnSubmit_Click" CausesValidation="False"></telerik:RadButton>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    </form>

这里需要一些欢迎语

下面是隐藏的代码:

using System;
using System.Configuration;
using TRACERiskLibrary.Entities;
using TRACERiskLibrary.Managers;

namespace TRACERisk
{
    public partial class Default2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        /// <summary>
        /// This function will get fired when a user submits the Risk Assessment data. It will verify that all of the 
        /// data is accurate and then will save the entry to the Azure Table that is found within the web.config file.
        /// If any of the data is inaccurate or there is a problem with the saving of the data, the error will be
        /// displayed to the user within the RadWindowManager Alert window.
        /// </summary>
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            String azureconn = ConfigurationManager.ConnectionStrings["traceRiskAzure"].ConnectionString;
            String azuretable = ConfigurationManager.AppSettings["AzureTable"];

            if (TxtEmail.Text.CompareTo("") == 0 || TxtEmail.Text.IndexOf('@') < 0 || TxtEmail.Text.IndexOf('.') < 0)
            {
                DefaultWindowMgr.RadAlert("You must enter in a valid Email Address for this submission to be valid. Please try again.", 400, 250, "Risk Survey Submission Error", "");
                return;
            }

            DellRiskEntity entity = new DellRiskEntity(TxtEmail.Text);

            if (TxtCompany.Text.CompareTo("") == 0)
            {
                DefaultWindowMgr.RadAlert("You must enter in a Company Name for this submission to be valid. Please try again.", 400, 250, "Risk Survey Submission Error", "");
                return;
            }
            else
                entity.Company = TxtCompany.Text;

            entity.PrimaryBus = DDLPrimary.SelectedItem.Text;
            entity.PrimaryScore = (Int32) Decimal.Parse(DDLPrimary.SelectedValue);
            entity.SecondaryBus = DDLSecondary.SelectedItem.Text;
            entity.SecondaryScore = (Int32) Decimal.Parse(DDLSecondary.SelectedValue);

            // Verify that the user entered in at least one country of business, if not throw up an error message and stop processing. 
            Int32 countryscore = 0;
            if (LstCountries.SelectedItems.Count == 0)
            {
                DefaultWindowMgr.RadAlert("Please select one or more Countries for which you do business before submitting.", 400, 250, "Risk Survey Submission Error", "");
                return;
            }
            else
            {
                for (int i = 0; i < LstCountries.SelectedItems.Count; i++)
                {
                    entity.Countries.Add(LstCountries.SelectedItems[i].Text);
                    if (Int32.Parse(LstCountries.SelectedItems[i].Value) > countryscore)
                        countryscore = Int32.Parse(LstCountries.SelectedItems[i].Value);
                }
            }
            entity.CountryScore = countryscore;
            entity.TotalScore = entity.PrimaryScore + entity.SecondaryScore + entity.CountryScore;

            if (entity.TotalScore < 11)
                entity.TierLevel = "Tier 1";
            else if (entity.TotalScore < 21)
                entity.TierLevel = "Tier 2";
            else
                entity.TierLevel = "Tier 3";

            // Process the actual saving of the Risk Assessment within the Azure Table
            if (RiskManager.SaveEntry(entity, azureconn, azuretable))
                DefaultWindowMgr.RadAlert("Your Risk Assessment has been Successfully submitted.", 400, 250, "Risk Survey Submitted", "");
            else
                DefaultWindowMgr.RadAlert("There is a record within the Risk Assessment associated with this email address. Please enter new Risk Assessment Data.", 400, 250, "Risk Survey Submission Error", "");
        }
    }
}
使用系统;
使用系统配置;
使用TRACERiskLibrary.Entities;
使用TRACERiskLibrary.Managers;
命名空间跟踪器
{
公共部分类Default2:System.Web.UI.Page
{
受保护的无效页面加载(对象发送方、事件参数e)
{
}
/// 
///当用户提交风险评估数据时,此功能将被触发。它将验证所有
///数据是准确的,然后将条目保存到web.config文件中的Azure表中。
///如果任何数据不准确或保存数据时出现问题,则会出现错误
///在RadWindowManager警报窗口中向用户显示。
/// 
受保护的void btnsupmit\u单击(对象发送者,事件参数e)
{
String azureconn=ConfigurationManager.ConnectionString[“traceRiskAzure”]。ConnectionString;
字符串azuretable=ConfigurationManager.AppSettings[“azuretable”];
if(TxtEmail.Text.CompareTo(“”==0 | | | TxtEmail.Text.IndexOf('@')<0 | | | TxtEmail.Text.IndexOf('.')<0)
{
DefaultWindowMgr.RadAlert(“您必须输入有效的电子邮件地址才能使此提交有效。请重试。”,400,250,“风险调查提交错误”,”;
返回;
}
DellRiskEntity实体=新的DellRiskEntity(TxtEmail.Text);
if(TxtCompany.Text.CompareTo(“”==0)
{
DefaultWindowMgr.RadAlert(“您必须输入公司名称才能使此提交有效。请重试。”,400250,“风险调查提交错误”,”;
返回;
}
其他的
entity.Company=TxtCompany.Text;
entity.PrimaryBus=DDLPrimary.SelectedItem.Text;
entity.PrimaryScore=(Int32)Decimal.Parse(DDLPrimary.SelectedValue);
entity.SecondaryBus=DDLSecondary.SelectedItem.Text;
entity.SecondaryScore=(Int32)Decimal.Parse(DDLSecondary.SelectedValue);
//验证用户是否输入了至少一个国家/地区的业务,如果没有,则抛出错误消息并停止处理。
Int32 countryscore=0;
如果(LstCountries.SelectedItems.Count==0)
{
DefaultWindowMgr.RadAlert(“请在提交前选择一个或多个您开展业务的国家/地区。”,400250,“风险调查提交错误”,”);
返回;
}
其他的
{
对于(int i=0;icountryscore)
countryscore=Int32.Parse(LstCountries.SelectedItems[i].Value);
}
}
entity.CountryScore=CountryScore;
entity.TotalScore=entity.PrimaryScore+entity.SecondaryScore+entity.CountryScore;
if(entity.TotalScore<11)
entity.TierLevel=“第1层”;
否则如果(entity.TotalScore<21)
entity.TierLevel=“Tier 2”;
其他的
entity.TierLevel=“第3层”;
//在Azure表中处理风险评估的实际保存
if(RiskManager.SaveEntry(实体、azureconn、azuretable))
DefaultWindowMgr.RadAlert(“您的风险评估已成功提交。”,400250,“已提交风险调查”);
其他的
DefaultWindowMgr.RadAlert(“与此电子邮件地址关联的风险评估中有一条记录。请输入新的风险评估数据。”,400250,“风险调查提交错误”,”;
}
}
}

你需要用一个简单的例子来分享你的代码,以减少问题空间。好吧,下面是一个奇怪的事情。当我在web.config文件的system.web区域中输入时,后面的代码就被调用了,但这只是第一次。从那以后,每次代码都不起作用。思想?布里亚尼猜是出了什么差错。您是否有记录所有未处理异常的
应用程序\u Error()
日志?在本地计算机上运行此操作时-您是否使用IIS或“ASP.NET开发服务器”(Cassini)?我使用ASP.NET开发服务器,因为我在注册表中遇到类似问题