query-string

Asp.net - Empty QueryString Parameter

The Problem What is the proper way to check for the foo parameter in the following url's querystring using asp.net? Is this even possible? http://example.com?bar=3&foo I have tried checking Request["foo"] as well as Request.QueryString["foo"] and I get null for both. I have also tried populating a List with the values from the ...

Fastest way to implode an associative array with keys

I'm looking for a fast way to turn an associative array in to a string. Typical structure would be like a URL query string but with customizable separators so I can use '&' for xhtml links or '&' otherwise. My first inclination is to use foreach but since my method could be called many times in one request I fear it might be too slo...

ASP.NET MVC - Mapping more than one query string parameter to a pretty url

I am a bit stuck on the design of my seo friendly urls for mvc....Take for example the following url: http://myapp/venues/resturants.aspx?location=central&orderBy=top-rated With my mvc app i have mapped it as follows: http://myapp/venues/list/resturants/central/top-rated {controller}/{action}/{category}/{location}/{order} Now the o...

How should I encode dictionaries into HTTP GET query strings?

An HTTP GET query string is a ordered sequence of key/value pairs: ?spam=eggs&spam=ham&foo=bar Is, with certain semantics, equivalent to the following dictionary: {'spam': ['eggs', 'ham'], 'foo': bar} This happens to work well for boolean properties of that page being requested: ?expand=1&expand=2&highlight=7&highlight=9 {'expand'...

In MVC, should pagination info go in the path or querystring?

In the path: Format: http://mydomain.com/{category}/{subcategory}/{pageNumber}/{pageSize} Example: http://mydomain.com/books/thriller/3/25 In the querystring: Format: http://mydomain.com/{category}/{subcategory}? pageNumber={pageNumber}&pageSize={pageSize} Example: http://mydomain.com/books/thriller?pageNumber=3&pageSize=25 I l...

Why would Apache be URL decoding my query string?

Hello, My Web host has refused to help me with this, so I'm coming to the wise folks here for some help "black-box debugging". Here's an edited version of what I sent to them: I have two (among other) domains at dreamhost: 1) thefigtrees.net 2) shouldivoteformccain.com I noticed today that when I host a CGI script on #1, that by th...

Represent a query string in JSON

I have this Javascript data: [{id:123,type:"test"},{id:154,type:"another"}] How would you transform that into something so that I can pass it as a HTTP post request? menu[0][id] = 123 menu[0][type] = test menu[1][id] = 154 menu[1][type] = another I dont want to pass the actual JSON data, I want to clean it up and pass it as formatt...

ASP.NET MVC QueryString defaults overriding supplied values?

Using ASP.NET MVC Preview 5 (though this has also been tried with the Beta), it appears that querystring defaults in a route override the value that is passed in on the query string. A repro is to write a controller like this: public class TestController : Controller { public ActionResult Foo(int x) { Trace.WriteLine(x);...

Alternative Query String C# (asp.net)

Is there a quick and dirty way of using a query passed as follows: domain.com/mypage.aspx/product/toycar/ I've done it before in PHP, but this needs to be done in page (in this instance). -- I only have access to the aspx page and code behind, and have to work in asp.net 2 (i wish i was using 3.5) ...

How do you configure Apache/PHP to accept slashes in query strings?

I have two Apache servers running PHP. One accepts forward-slashes in the query string and passes it along to PHP in the expected way, for example: http://server/index.php?url=http://foo.bar works and in PHP this expression is true: $_REQUEST['url'] == "http://foo.bar" However, in the other Apache server, the same URL results in a ...

Is it possible to access anchors in a querystring via PHP?

I have a page that is accessed via a URL like this: http://power-coder.net/Test/something.php?id=3#Page1 I know how to access the id parameter using $_GET, however is there a way for me to access the #Page1 part? I have looked at the $_SERVER array and the REQUEST_URI ends at ?id=3. I know that I could also change the #Page1 to be an...

Adding a parameter to the URL with JavaScript

In a web application that makes use of AJAX calls, I need to submit a request but add a parameter to the end of the URL, for example: Original URL: http://server/myapp.php?id=10 Resulting URL: http://server/myapp.php?id=10&enabled=true Looking for a JavaScript function which parses the URL looking at each parameter, the...

Versioning CSS files with a query string like Stackoverflow does?

If you look at Stackoverflow.com's source you'll see the reference to their css file is: <link href="/Content/all.min.css?v=2383" rel="stylesheet" type="text/css" /> How is this done so they can pass a version via query string and have the correct CSS file served up? ...

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 as the referer URL carries the url that the person was trying to visit (dont ask why, Ive no idea) it causes me to have a duplicate of every...

Passing multiple values for a single parameter in Reporting Services

I have several Multi-Select parameters in my report. I am trying to find a way to pass in multiple values for a single parameter in the web query string? If I pass in a single value, it works fine. The report runs fine selecting multiple choices for a single param. My trouble lies in the web query string. ...

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

Hi, 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 first,middle or last. so i will have this Default.aspx?Agent=20 ...

Ampersands in URLRewriter Query Strings

I have a query string parameter value that contains an ampersand. For example, a valid value for the parameter may be: a & b When I generate the URL that contains the parameter, I'm using System.Web.HTTPUtility.UrlEncode() to make each element URL-friendly. It's (correctly) giving me a URL like: http://example.com/foo?bar=a+%26b The...

Remove all query strings from requests for particular page.

I have a flex application that for some reason I do not know why, when you are using google chrome and access the page with any query strings in the URL the applications behaves unexpectedly. The page does not need query strings though. But many things like adwords etc are passing variables in query strings for tracking purposes. But f...

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"; Response.Redirect("http://www.mysite.com/?Value=" + Server.UrlEncode(value)); This howerver returns http://www.mysite.com/?Value=This+&amp;+That What should I be using to encode this st...

Looping through a request.querystring in VB.NET

I am trying to loop through a query string and pull out certain values as in: ?ProductID=1234&ProductID=4321&Quantity=1 For each value next to ProductID I want to execute some logic. But I am not sure how to get to the values. Any ideas? ...