解決済み: IE 10 ではヌル文字の処理に問題があるようです。サーバー側で大量のコードを生成しているため、バッファリングによってリスト アイテム データに NULL 文字が発生し、ViewState が破損していました (NULL は有効な base64 文字ではありません)。小さなデータセットでは破損が発生していなかったので、これに気付きました
Response.Buffer = false
リストアイテムの生成中に設定することで問題を解決しました。私が手を出した他の可能な解決策:
-ListBox.DataSource = new DataView(dataTable)
そしてListBox.DataBind()
リストボックスデータ用。これにより、クリーンなデータが得られましたが、私の場合はストアド プロシージャの変更が必要でした
<option>
-要素の外側に NULL が表示されるようにバッファを適切にクリアする
多くの調査を行った後でも、Web アプリケーションで無効なビューステート エラーが発生します。
要約する:
- オンラインで見つけた ViewState 検査機能を使用しましたが、ViewState を解析できないため、役に立ちませんでした。2 番目のペアは「読み取り不能データ」を返します
- IE 10 のみで一貫しています。他のブラウザでは表示されません
- ドキュメント モード IE9 標準で正常に動作します (IE10 標準のサポートに取り組んでいます)。
- ページの 2 つのメイン フィールド (2 つのリストボックス) は では機能しない
EnableViewState="False"
ため、これに関する回避策は望ましいオプションではありません。 - ページのソースを調べたところ、
NUL
Base64 文字列に文字が含まれています。
私の推測では、ViewState が NUL 文字で切り捨てられており、予期される ViewState が受信したものと同じではないため、エラーがスローされます。ただし、これを検証する方法、破損したデータの原因を絞り込む方法、および問題を解決する方法に行き詰まっています。
更新: データ セットに NUL 文字が見つかりました。この文字を ViewState から削除すると問題が解決します...データベースを見ると、データは完全に正常に見えます。[NUL]
が正当なヌル文字であると想像してください
ビューステート:
...pZmUFBTE[NUL]4NjoxZxAFD1RJQUEt...
リストボックスのオプションの 1 つ:
<option value="201:1" title="Pr[NUL]emier 20">Premier 20</option>
さて、この破損がどこで発生しているかを追跡する必要があると思いますか?
コード
if (!IsPostBack)
{
System.Web.UI.WebControls.ListItem liListItem;
clsGLOBALGASubscription clsGAS = new clsGLOBALGASubscription(lngSubID);
DataTable dataTable = clsGAS.ListSelectedProducts(Session["GAID"].ToString().Trim());
if(dataTable == null)
{
lstbAvailable.Items.Add("There are no products available for your account. Please contact your administrator.");
btnAdd.Visible = false;
btnAddAll.Visible = false;
btnRemove.Visible = false;
btnRemoveAll.Visible = false;
}
else
{
if(Session["SelectedProducts"] != null && Session["SelectedProducts"].ToString().Trim().Length != 0)
{
foreach(DataRow dataRow in dataTable.Rows)
{
string strConcatIDs = dataRow["CompanyID"] + ":" + dataRow["SeriesID"];
liListItem = new ListItem(dataRow["Company"] + " - " + dataRow["Series"], strConcatIDs);
liListItem.Attributes.Add("title", String.Format("{0} - {1}", dataRow["Company"], dataRow["Series"]));
foreach(string subString in Session["SelectedProducts"].ToString().Split(delimiters))
{
if(subString == strConcatIDs)
if (xraeList)
{
foreach (string CarrierHealthItem in XraeCarrierList)
{
string[] CarrierInforArray = CarrierHealthItem.Split(':');
if (CarrierInforArray[0].ToString() == dataRow["CompanyID"].ToString())
{
foundXrae = true;
break;
}
}
if (foundXrae)
{
liListItem.Attributes.CssStyle.Add(HtmlTextWriterStyle.Color, "Red");
liListItem.Attributes.CssStyle.Add(HtmlTextWriterStyle.FontWeight, "bold");
foundXrae = false;
}
}
lstbSelected.Items.Add(liListItem);
bSelectedAlready = true;
break;
}
}
if (bSelectedAlready == false)
{
if (xraeList)
{
foreach (string CarrierHealthItem in XraeCarrierList)
{
string[] CarrierInforArray = CarrierHealthItem.Split(':');
if (CarrierInforArray[0].ToString() == dataRow["CompanyID"].ToString())
{
foundXrae = true;
break;
}
}
if (foundXrae)
{
liListItem.Attributes.CssStyle.Add(HtmlTextWriterStyle.Color, "Red");
liListItem.Attributes.CssStyle.Add(HtmlTextWriterStyle.FontWeight, "bold");
foundXrae = false;
}
}
lstbAvailable.Items.Add(liListItem);
}
else
{
bSelectedAlready = false;
}
}
}
else // ...no Selected Products, so just populate lstbAvailable
{
foreach(DataRow dataRow in dataTable.Rows)
{
liListItem = new System.Web.UI.WebControls.ListItem(dataRow["Company"] + " - " + dataRow["Series"], dataRow["CompanyID"] + ":" + dataRow["SeriesID"]);
liListItem.Attributes.Add("title", String.Format("{0} - {1}", dataRow["Company"], dataRow["Series"]));
if (xraeList)
{
foreach (string CarrierHealthItem in XraeCarrierList)
{
string[] CarrierInforArray = CarrierHealthItem.Split(':');
if (CarrierInforArray[0].ToString() == dataRow["CompanyID"].ToString())
{
foundXrae = true;
break;
}
}
if (foundXrae)
{
liListItem.Attributes.CssStyle.Add(HtmlTextWriterStyle.Color, "Red");
liListItem.Attributes.CssStyle.Add(HtmlTextWriterStyle.FontWeight, "bold");
foundXrae = false;
}
}
lstbAvailable.Items.Add(liListItem);
}
}
}
}
}
エラー:
The state information is invalid for this page and might be corrupted.
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters. ]
System.Convert.FromBase64String(String s) +0
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +90
System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +60
System.Web.UI.HiddenFieldPageStatePersister.Load() +173
[ViewStateException: Invalid viewstate.
Client IP: 10.128.3.10
Port: 44359
Referer: http://LTCarrierProduct.aspx?Title=Customize Carriers and Products&XraeValidation=Invalid
Path: /LTCarrierProduct.aspx
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)
ViewState: /wEPDwUJNzE5MTU3Njg2D2QWBgIBDxYCHgRUZXh0BY4BPExJTksgaHJlZj0nU3R5bGVzL0xUU3R5bGVzLmNzcycgdHlwZT0ndGV4dC9jc3MnIHJlbD0nc3R5bGVzaGVldCcgLz48TElOSyBocmVmPSdTdHlsZXMvMDE1ODFfTFRTdHlsZXMuY3NzJyB0eXBlPSd0ZXh0L2NzcycgcmVsPSdzdHlsZXNoZWV0JyAvPmQCAw8WAh8AZWQCBQ9kFgQCAQ8QZA8WxgFmAgECAgIDAgQCBQIGAgcCCAIJAgoCCwIMAg0CDgIPAhACEQISAhMCFAIVAhYCFwIYAhkCGgIbAhwCHQIeAh8CIAIhAiICIwIkAiUCJgInAigCKQIqAisCLAItAi4CLwIwAjECMgIzAjQCNQI2AjcCOAI5AjoCOwI8Aj0CPgI/AkACQQJCAkMCRAJFAkYCRwJIAkkCSgJLAkwCTQJOAk8CUAJRAlICUwJUAlUCVgJXAlgCWQJaAlsCXAJdAl4CXwJgAmECYgJjAmQCZQJmAmcCaAJpAmoCawJsAm0CbgJvAnACcQJyAnMCdAJ1AnYCdwJ4AnkCegJ7AnwCfQJ+An8CgAECgQECggECgwEChAEChQEChgEChwECiAECiQECigECiwECjAECjQECjgECjwECkAECkQECkgECkwEClAEClQEClgEClwECmAECmQECmgECmwECnAECnQE...]
[HttpException (0x80004005): The state information is invalid for this page and might be corrupted.]
System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +177
System.Web.UI.HiddenFieldPageStatePersister.Load() +11367569
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +11447671
System.Web.UI.Page.LoadAllState() +56
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11441698
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11441214
System.Web.UI.Page.ProcessRequest() +269
System.Web.UI.Page.ProcessRequest(HttpContext context) +167
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +625
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270
サーバー上の ie.browsers から:
<browser id="IE6to9" parentID="IE5to9">
<identification>
<capability name="majorversion" match="[6-9]" />
</identification>
<capture></capture>
<capabilities>
<capability name="jscriptversion" value="5.6" />
<capability name="ExchangeOmaSupported" value="true" />
</capabilities>
</browser>