British date format on Reporting server turns to US format on client side via MS SSRS

霸气de小男生 提交于 2019-12-02 18:09:42

问题


I have problem retrieving correct date format on client side using MS reporting service 2010.

The British date format (18/05/2011) of date type is assigned to the default value of a parameter in a rdl file hosted on the reproting server. However, when the date value becomes US format (5/18/2011) via reporting service 2010.

 ReportingService2010 reportingService = new ReportingService2010();
 reportingService.Credentials = CredentialCache.DefaultCredentials;

ItemParameter[] parameters = reportingService.GetItemParameters(reportUrl, historyId, forRendering, values, credentialses);

 foreach (var parameter in parameters)
                {

               //parameter.DefaultValues //date value changed from British value to US
                }

Any idea?

Accessing the SOAP API


回答1:


I have to create a partial class alongside the generated ReportingService class and override the GetWebRequest method, then add an Accept-Language header to the Web request. Here is a sample class:

public partial class ReportingService

{

 protected override System.Net.WebRequest GetWebRequest(Uri uri)
    {
        WebRequest request = base.GetWebRequest(uri);

        request.Headers.Add(HttpRequestHeader.AcceptLanguage, CultureInfo.CurrentCulture.Name);

        return request;
    }

}


来源:https://stackoverflow.com/questions/8309464/british-date-format-on-reporting-server-turns-to-us-format-on-client-side-via-ms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!