Skip to content

COMException (0x80020009): Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))

September 17, 2012

We had a standard SharePoint list where
• grouping was used in the list view
• at least one group contained more than 100 listitems

The user
• expanded the group with 100 listitems and clicked on the “more…” link to see the next page of the group.
• then chose “New item” from the menu to add a new listitem.
• Filled in the new form, and clicked OK

then received the following error:

System.Runtime.InteropServices.COMException: Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))

[COMException (0x80020009): Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))]
Microsoft.SharePoint.Library.SPRequestInternalClass.RenderViewAsHtml(String bstrUrl, String bstrListName, String bstrViewID, String bstrViewXml, String bstrQualifier, ISPDataCallback pDataCallback, Boolean& pbSharedList) +0
Microsoft.SharePoint.Library.SPRequest.RenderViewAsHtml(String bstrUrl, String bstrListName, String bstrViewID, String bstrViewXml, String bstrQualifier, ISPDataCallback pDataCallback, Boolean& pbSharedList) +255

[SPException: Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))]
Microsoft.SharePoint.Library.SPRequest.RenderViewAsHtml(String bstrUrl, String bstrListName, String bstrViewID, String bstrViewXml, String bstrQualifier, ISPDataCallback pDataCallback, Boolean& pbSharedList) +363
Microsoft.SharePoint.WebPartPages.ListViewWebPart.RenderView() +2129
Microsoft.SharePoint.WebPartPages.ListViewWebPart.EnsureData(Int32 token) +1368
Microsoft.SharePoint.WebPartPages.SharePointDataProvider.Execute() +343
Microsoft.SharePoint.WebPartPages.SPWebPartManager.ActivateV2ConnectionsAndSharePointDataFetch() +270
Microsoft.SharePoint.WebPartPages.SPWebPartManager.ActivateConnections() +137
System.Web.UI.WebControls.WebParts.WebPartManager.OnPageLoadComplete(Object sender, EventArgs e) +70
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Page.OnLoadComplete(EventArgs e) +11042078
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3160

We had a HttpModule running on the IIS that did some URL transformations but it was not supposed to change the standard SharePoint URLs. After some troubleshooting we realized that the URL were changed by the HttpModule – they were UrlDecoded without any particular reason.

Original (good) URL:

http://server/Lists/MyList/NewForm.aspx?Source=http%3A%2F%2Fserver%2FLists%2FMyList%2FAllItems.aspx%3FPaged%3DTRUE%26p_Title%3DMyTitle%26p_ID%3D200%26View%3D%257b3AA22486%252d631A%252d497B%252dBB24%252dA8E7F827D237%257d%26GroupString%3D%E2%80%A6%26DrillDown%3D1%26PageFirstRow%3D201

New (bad) URL:

http://server/Lists/MyList/NewForm.aspx?Source=http://server/Lists/MyList/AllItems.aspx?Paged=TRUE&p_Title=MyTitle&p_ID=200&View=%7b3AA22486%2d631A%2d497B%2dBB24%2dA8E7F827D237%7d&GroupString=…&DrillDown=1&PageFirstRow=201

As you can see, the problem is in the Source parameter, which is an url itself, with its own querystring parameters.

Then we started to analyze the HttpModule to find out how the URLs got UrlDecoded. It did not contain any call to HttpUtility.UrlDecode or HttpServerUtility.UrlDecode nor any custom logic to do the decoding so we suspected that they were decoded as a sideeffect of something.

And that was the right assumption. We had to realize that some .NET methods UrlDecoded the URLs in a background. See the list of the methods and the solutions in this article.

Advertisements

From → .NET, ASP.NET, SharePoint

One Comment

Trackbacks & Pingbacks

  1. URLs UrlDecoded « ExpectedException

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: