Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9181445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:18:55+00:00 2026-06-17T18:18:55+00:00

I’ve come accross a problem when trying to use WebClient to export a report

  • 0

I’ve come accross a problem when trying to use WebClient to export a report from Reporting Services.

Everything works fine if I use my code to load a report that doesn’t contain any parameters, once I try to pass parameters I am getting a 500 Server Error.

If I hit the Reporting Services URL in a web browser the report loads fine and it takes the parameter values specified in the querystring and returns the report in Excel format.

This is something i’ve done in the past, so really stumped as to what the problem is. Below is some of the code i’m using, as said this works fine with a report that doesn’t have parameters. This is not final code by any means but I need to get it working with parameters first

string url = "http://localhost/Reportserver?/ReportsFolder%2fTheReport&rs:Format=EXCEL&rs:Command=Render&Start=15-01-2013&End=15-01-2013";

WebClient c = new WebClient();
c.UseDefaultCredentials = true;
c.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
byte[] data = c.DownloadData(url);

The fact it works fine when opening the link in the web browser it stumping me, and this issue only occurs with reports that have parameters.

UPDATE

I’ve just realised where was going wrong, it was the format of dates. I was entering a UK formatted date dd/mm/yyyy (15-01/2013)

It’s still a strange one thought because providing it in the UK format works fine when pasting the URL into the web browser.

When supplying a UK date using the WebClient code above, I get the error. I’m not sure why it would be different using either method, no longer a problem for me, but still would be interested to know why this is so…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:18:56+00:00Added an answer on June 17, 2026 at 6:18 pm

    Ensure that the date is sent in the format of mm/dd/yyyy when sending the request via WebClient.

    It appears that even if the UK date format dd/mm/yyyy works in IE, it does not when making the request via WebClient and the code in the original question.

    The reverse appears to be true in my case that when pasting the URL into IE an error will be thrown if the date is provided in the US format of mm/dd/yyyy

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
I am confused How to use looping for Json response Array in another Array.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.