vendredi 31 juillet 2015

C# URL query string parameters not parsing correctly in FireFox or Chrome

I have a function in my code to open various reports in SSRS, which may or may not need to accept a parameter(s). I'm passing the URL and parameters as follows:

var reportUrl = ConfigurationManager.AppSettings["ReportServerUrl"];
        var reportPathComponents = ConfigurationManager.AppSettings["ReportPath"].Split(';');
        var reportPath = string.Join("&", reportPathComponents);

        return reportUrl + string.Format(reportPath, start.ToShortDateString(), end.ToShortDateString());

Possible inputs are:

reportUrl = "http://ssrs14devreports..." ReportPath = "Report;rs:Command=Render;start={0};end={1}"

This works just fine in IE 11 but in the latest Chrome and FireFox browsers it encodes the "&" as "&".

Aucun commentaire:

Enregistrer un commentaire