0

i have a Url of report that is on the SSRS server, the Url contains:

http://<**ServerAdress**>/<**ServerName**>/Pages/ReportViewer.aspx?<**reportPath**>&<**report_Parameters**>

programmatically (using C#) i want to execute the url without opening the browser. when i use the ReportExecutionService i have to define the parameters manually (using ParameterValue[]...) i dont know how to invoke them from the url. so, is there a way i can execute the report with the url without opening the browser?

Michael meshaev
  • 31
  • 1
  • 11

1 Answers1

0

You can programmatically call a URL using C#:

    public static async Task<bool> CallUrl(string url)
    {
        try
        {
            var client = new HttpClient();

            client.DefaultRequestHeaders.TryAddWithoutValidation("Accept",
                "text/html,application/xhtml+xml,application/xml");
            client.DefaultRequestHeaders.TryAddWithoutValidation("Accept-Encoding", "gzip, deflate");
            client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent",
                "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0");
            client.DefaultRequestHeaders.TryAddWithoutValidation("Accept-Charset", "ISO-8859-1");

            var response = await client.GetAsync(url);
            response.EnsureSuccessStatusCode();

            return true;
        }
        catch
        {
            return false;
        }
    }

Example of calling that method:

        var result = CallUrl("http://www.bbc.co.uk");
        result.Wait();
        Console.WriteLine(result.Result);

This should run your report, without opening the browser.

HenrikV
  • 401
  • 1
  • 4
  • 6