137
votes
20answers
69k views

How to build a query string for a URL in C#?

A common task when calling web resources from a code is building a query string to including all the necessary parameters. While by all means no rocket science, there are some nifty details you need ...
20
votes
10answers
48k views

How can i remove item from querystring in asp.net using c#?

I want remove "Language" querystring from my url. How can i do this ? (using Asp.net 3.5 , c#) Default.aspx?Agent=10&Language=2 I want to remove "Language=2", but language would be the ...
14
votes
6answers
11k views

Outputing a manipulated QueryString in c#

Using the following code I get a nice formatted string: Request.QueryString.ToString Gives me something like: &hello=world&microsoft=sucks But when I use this code to clone the collection ...
8
votes
6answers
29k views

ASP.Net URLEncode Ampersand for use in Query String

I need to redirect to a url passing a parameter as a query string. This can include an Ampersand in the value. such as string value = "This & That"; ...
6
votes
7answers
13k views

C# ASP.NET QueryString parser

If you have been looking for a nice and clean way to parse your query string values, I have come up with this: /// <summary> /// Parses the query string and returns a valid value. ...
20
votes
6answers
19k views

Truncating Query String & Returning Clean URL C# ASP.net

I would like to take the original URL, truncate the query string parameters, and return a cleaned up version of the URL. I would like it to occur across the whole application, so performing through ...
0
votes
3answers
4k views

How to get a querystring when it is URLEncoded or has percent characters in ASP.NET

How to get the actual querystring from the Request object when the querystring is UrlEncoded or has percent characters in ASP.NET? Basicly, if I have a Url like this: Default.aspx?p=%b4, how do I ...
2
votes
3answers
1k views

DateTime.ParseExact format string

I have a web application that passes a DateTime from one page to another through the query string. It was working just fine in both IE and FireFox, but was throwing exceptions whenever I tried it in ...
2
votes
4answers
2k views

querystring in asp.net

how to use querystring in asp.net.
1
vote
1answer
218 views

Opening html file with query string

Is it possible to load a local HTML file with a query string? I'm using Process.Start, but that fails because appending ?querystring=test to the end of the filename makes it search for that. ...
1
vote
3answers
5k views

How can you secure/encrypt your querystring in asp.net?

I was wondering how you could encrypt/decrypt your querystring in a simple asp.net page? some values need to be passed between different pages but the querystring cannot be changed or read. Some say ...
2
votes
4answers
1k views

Is it possible to change the querystring variable in ASP.NET MVC path before it hits the controller?

I have a controller method in ASP.NET MVC that looks like this: public ActionResult GetAlbumPictures(int albumId) { var album = AlbumRepo.GetSingle(albumId); var pictures = album.Pictures; ...
1
vote
3answers
4k views

Whats the quickest way to dedupe a querystring in C# (ASP.net)

I have an issue whereby the company uses a business tracking system that captures a users first visit and redirects them to the page they were trying to visit but with a refferer URL attached... Now ...
5
votes
4answers
9k views

Is there a way to get all the querystring name/value pairs into a collection?

Is there a way to get all the querystring name/value pairs into a collection? I'm looking for a built in way in .net, if not I can just split on the & and load a collection.
4
votes
5answers
2k views

How to efficiently remove a query string by Key from a Url?

How to remove a query string by Key from a Url? I have the below method which works fine but just wondering is there any better/shorter way? or a built-in .NET method which can do it more ...

1 2
15 30 50 per page