如何阻止asp.net尝试加载sharepoint?

如何阻止asp.net尝试加载sharepoint?,asp.net,.net,sharepoint,Asp.net,.net,Sharepoint,我有一个ASP.net表单页面,它充当代理 我的网站正在从另一个网站companyX.com下载一些内容 companyX.com的网站正在使用sharePoint 我的网站正在从companyX.com下载HTML并成功地将其添加到我的页面,但是,在page\u Init、page\u Load和page\u Unload之后,但在Render之前,我的页面抛出了粘贴在下面的错误 我的网站没有安装任何sharepoint。但是,asp.net中似乎有某种东西正在处理我页面中的HTML内容,识别

我有一个ASP.net表单页面,它充当代理

我的网站正在从另一个网站companyX.com下载一些内容

companyX.com的网站正在使用sharePoint

我的网站正在从companyX.com下载HTML并成功地将其添加到我的页面,但是,在
page\u Init、page\u Load
page\u Unload
之后,但在
Render
之前,我的页面抛出了粘贴在下面的错误

我的网站没有安装任何sharepoint。但是,asp.net中似乎有某种东西正在处理我页面中的HTML内容,识别一些sharepoint标记,然后尝试加载sharepoint。我想把它关掉

我的页面确实有
EnableViewState=“false”EnableViewStateMac=“false”ValidateRequest=“false”

错误:

System.Web.HttpException (0x80004005): The state information is invalid for this page and might be corrupted. ---> System.Web.UI.ViewStateException: Invalid viewstate. 
    Client IP: 127.0.0.1
    Port: 55413
    Referer: xxx/App.aspx?id=xxx
    Path: /App.aspx
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36
    ViewState: xxx... ---> System.ArgumentException: The serialized data is invalid. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
   at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
   at System.Type.GetType(String typeName, Boolean throwOnError)
   at System.Web.UI.ObjectStateFormatter.DeserializeType(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader)
   at System.Web.UI.ObjectStateFormatter.Deserialize(Stream inputStream)
   --- End of inner exception stack trace ---
   at System.Web.UI.ObjectStateFormatter.Deserialize(Stream inputStream)
   at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString, Purpose purpose)
   at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter2.Deserialize(String serializedState, Purpose purpose)
   at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter2 formatter, String serializedState, Purpose purpose)
   at System.Web.UI.HiddenFieldPageStatePersister.Load()
   --- End of inner exception stack trace ---
   at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)
   at System.Web.UI.HiddenFieldPageStatePersister.Load()
   at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
   at System.Web.UI.Page.LoadAllState()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.app_aspx.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

ASP.net并没有绑定到加载Sharepoint,它试图理解您正在检索的页面中包含的ViewState,但无法理解,因为它是由另一台具有不同机器密钥的服务器构建的


在呈现阶段之前,我会亲自从检索到的HTML中删除ViewState隐藏字段,否则您可能会遇到持续的问题,这些问题可能会随机混淆问题。

我最终通过在页面中添加以下内容来修复它:

Protected Overrides Function LoadPageStateFromPersistenceMedium() As Object
    Return Nothing
End Function

谢谢你的反馈。我不希望删除viewstate数据。我是否可以告诉asp.net只将页面视为文本,而不尝试解析viewstate?另外,如果它不尝试加载sharepoint,为什么会出现以下错误:FileNotFoundException:无法加载文件或程序集的Microsoft.SharePointI添加到web.congig。仍然得到相同的错误。还重写了页面的Validate函数,但没有效果。如何才能真正禁用viewstate?