ローカルで完全にテストした、かなり単純な単一ページのWebアプリケーションがあります。このアプリケーションは単純なフォーム送信であり、データはAzure TableStorageコンテナーに格納されます。ポップアップウィンドウにメッセージを表示してサーバー側の検証を行う[送信]ボタンのコードビハインド関数が1つあります。
すべてのデータストレージと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", "");
}
}
}