Reputation: 20560
I have written a report renderer in C# that runs and attaches reports to an email. This is all working great, except the date format of the parameters are incorrect when listed in the report title. All the reports have their language set to =User!Language
and the parameters are output using the FormatDateTime function to format according to the user's regional settings.
I am basically using the rendering method described here on MSDN.
This all works great when the reports are run through the browser. However, when I render the report from C# it uses en-US
date format.
The report server's regional settings are set appropriately to the correct region as are the regional settings of the computer the C# progam is running on..
What property do I need to set in my C# program for the report to be rendered using my appropriate language/culture?
Upvotes: 2
Views: 3556
Reputation: 3317
However, what you want to do in this case is override the GetWebRequest method on the ReportExecutionService, not the ReportingService like in that answer:
public partial class ReportExecution : ReportExecutionService
{
protected override WebRequest GetWebRequest(Uri uri)
{
WebRequest request = base.GetWebRequest(uri);
request.Headers.Add(HttpRequestHeader.AcceptLanguage, CultureInfo.CurrentCulture.Name);
return request;
}
}
Upvotes: 3