Error: Missing URL parameter: Name in Microsoft.ReportViewer.WebForms

I’ve had to deal with this error often now. It goes a little something like this:

Error in 'Microsoft.ReportViewer.WebForms'.
Missing URL parameter: Name
Exception: System.ArgumentException
at Microsoft.Reporting.WebForms.EmbeddedResourceOperation.PerformOperation(NameValueCollection
urlQuery, HttpResponse response)
at Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

The problem seems to be that the Uri that the ReportViewer control is sending to the server gets encoded resulting in “&Name=” being converted to “&Name=” (and the same with other parameters.

The ReportServer seems to be smart enough to be able to accept or decode the Uri as the resources get sent back. I’m not sure if the Exceptions that are thrown are thrown and then the Report Server tried to decode the Uri and returns the requested resource, but either way the user seems like they are getting the resource.

I’ve found this and this post which indicates that Bluecoat proxy can be the cause of the mangled Uri.

The second post (here) had an entry that indicated some code that could be run. I suspect that he wanted to replace “&” not “amp;” with “&”, but it is interesting. Here is the code that the person gave:

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
    If Not Request.ServerVariables.Item("HTTP_X_BLUECOAT_VIA") = Nothing Then
        HttpContext.Current.RewritePath(Request.Path & "?" & Replace(Request.QueryString.ToString, Server.UrlEncode("amp;"), "&"), True)
    End If
End Sub

I think the idea that they had has merit. And I hope to try this at a convenient time. Note that I haven’t changed the code example, but think that the test for “amp;” should possible be “&” as there would be “&&” instead of just “&” in the Uri (I suspect 🙂 )


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your 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: