우리는 검색을 사용하는 Sharepoint 사이트를 가지고 있습니다. 우리가 GridView 컨트롤에 DateKeyNames를 사용할 때 오류가 발생하는 것을 우리가 발견 한 시험의 조금 후DataKeynames를 사용할 때 셰어 포인트 검색이 실패합니다.
Unable to validate data. at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData (Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, IVType ivType, Boolean useValidationSymAlgo) at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)
:
우리는 다음과 같은 오류가 발생합니다.
검색,이 오류 및 DataKeyNames간에 조합이 있어야하는 이유를 잘 모릅니다.
아이디어가 있으십니까?
업데이트 : 여기에 몇 가지 코드
[Guid("8891224e-e830-4ffa-afbd-f789583d8d14")]
public class TestErrorGridView : System.Web.UI.WebControls.WebParts.WebPart
{
Control ascxToAdd;
public TestErrorGridView()
{
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
}
protected override void CreateChildControls()
{
base.CreateChildControls();
Table test = new Table();
TestBindObject t1 = new TestBindObject() { ID = 1, Name = "Test" };
List<TestBindObject> l1 = new List<TestBindObject>();
l1.Add(t1);
SPGridView testGrid = new SPGridView() { AutoGenerateColumns = false};
BoundField header = new BoundField();
header.DataField = "ID";
BoundField name = new BoundField();
name.DataField = "Name";
testGrid.Columns.Add(header);
testGrid.Columns.Add(name);
testGrid.DataSource = l1;
testGrid.DataBind();
// If you comment out this line search works
testGrid.DataKeyNames = new string[] { "ID" };
this.Controls.Add(testGrid);
base.CreateChildControls();
SPGridView testGrid = new SPGridView() { AutoGenerateColumns = false, EnableViewState=false };
testGrid.DataKeyNames = new string[] { "testid" };
this.Controls.Add(testGrid);
}
}
public class TestBindObject
{
public int ID { get; set; }
public string Name { get; set; }
}
UPDATE
이 오류는 개발자의 시스템에서 발생했을 것입니다, 그래서 클러스터의 다른 컴퓨터에 다른되는 기계 키에 realated되지 않습니다.
개발자 중 한 명이 MOSS를 설치 했으므로 오류가 발생하지 않습니다. WSS 만 설치 한 개발자는 오류가 발생합니다.
업데이트 2
내가 당신의 GridView의 데이터 소스뿐만 아니라 누락 된 코드 세트부터 여기 추측을 던질거야
오류가 발생한 코드를 게시 할 수 있습니까? –
@Kit 코드 샘플을 추가했습니다 –