Wednesday, July 8, 2009

WebSlice and “We are unable to display this view” error message

After spending way to much time trying to troubleshoot the error message in the title of the post, I broke out my favorite tool Fiddler and started looking at what was being sent on the wire.  I compared a very basic WebSlice being sent form an HTML WebPage that was imageworking and one from an ASP.NET MVC page that wasn’t. 

The basic HTML page was sending the mime type “text/html” and the failing ASP.NET MVC (and ASPX) pages were sending “application/xhtml+xml” when the WebSlice was being requested.  The result was the “We are unable to display this view” error message.  There might be a better ways of doing it, but I just ended up setting:

Response.ContentType = “text/html”

in the OnPreRender overload for the page.  This seems to have done the trick.

I noticed this in IIS 7.5.7100 on Windows 7 as well as my web server running Windows Server 2008.

Hope this saves someone a few minutes

-ec

No comments:

Post a Comment