简体   繁体   English

如何阻止asp.net尝试加载共享点?

[英]How to stop asp.net from trying to load sharepoint?

I have a ASP.net forms page that is acting as a proxy. 我有一个充当代理的ASP.net表单页面。

My website is downloading some content from another website, companyX.com. 我的网站正在从另一个网站companyX.com下载某些内容。

companyX.com's site is using sharePoint. companyX.com的网站正在使用sharePoint。

My site is downloading the HTML from companyX.com and successfully adding it to my page, however, after Page_Init, Page_Load and Page_Unload but before Render my page is throwing the error pasted below. 我的网站正在从companyX.com下载HTML并将其成功添加到我的页面中,但是,在Page_Init, Page_LoadPage_Unload但在“ Render之前,我的页面抛出了以下错误。

My site does not have any sharepoint installed. 我的网站没有安装任何共享点。 However, it looks like there is something in asp.net that is processing the HTML content in my page, recognizing some sharepoint tags and then trying to load sharepoint. 但是,好像asp.net中正在处理页面中的HTML内容,识别出一些共享点标记,然后尝试加载共享点。 I would love to turn this off! 我想关闭此功能!

My page does have EnableViewState="false" EnableViewStateMac="false" ValidateRequest="false" 我的页面确实具有EnableViewState="false" EnableViewStateMac="false" ValidateRequest="false"

Error: 错误:

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 isn't tying to load Sharepoint, it's trying to make sense of the ViewState contained in the page you are retrieving but cannot because it is built by another server with a different machine key et al. ASP.net并不打算加载Sharepoint,而是试图弄清您正在检索的页面中包含的ViewState,但不能这样做,因为它是由具有不同机器密钥的另一台服务器构建的。

I would personally remove the ViewState hidden field from the retrieved HTML prior to the Render stage, otherwise you might have ongoing issues that may confuse matters on a random basis. 在渲染阶段之前,我将亲自从检索到的HTML中删除ViewState隐藏字段,否则您可能会遇到持续出现的问题,这些问题可能会导致随机混乱。

I finally finally fixed it by adding the following to my page: 我终于通过在页面中添加以下内容来最终解决了该问题:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM