I am doing like this in pageload method
Request.QueryString.Add("Filter_DateRange", "yesterday");
Request.QueryString.Add("Filter_FormType", "10-K");
but it is giving an exception
"Collection is readonly"
.
Any way to do this?
I am doing like this in pageload method
Request.QueryString.Add("Filter_DateRange", "yesterday");
Request.QueryString.Add("Filter_FormType", "10-K");
but it is giving an exception
"Collection is readonly"
.
Any way to do this?
Based on the comments, there are some options to choose from to suit your needs...
For instance, you can abstract (and clearly should) the process of retrieving the values directly from a querystring and implement some kind of a layer, that does it for you. You can then swap this layer freely without worrying about breaking your app. The most basic approach to do this is to implement page properties. In your code you won't directly call Request.QueryString..., but instead you'll be working with these properties. When you'll want to change the source of your values, just change a property accordingly.
Another approach might be to create links you want to test and you can even place those links on a separate page, for instance testlinks.aspx. That way you can have things nicely organized for testing purposes.
And so on.
If you want to simulate the request object for automated testing i reccomend you look into Moles.
If you just want to manually test, why not just create a link with the query string params you need?