Vishal
Vishal

Reputation: 6378

Is the order of named parameters important in a URL?

Suppose, I have a URL that has two parameters named param1 and param2.

Are the below mentioned two URLs same?

http://www.example.com/abcd.aspx?param1=xxx&param2=yyy

http://www.example.com/abcd.aspx?param2=yyy&param1=xxx

Upvotes: 5

Views: 2890

Answers (5)

Dead.Rabit
Dead.Rabit

Reputation: 1975

According to the OData/REST standards, no.

If it's written by a tool that you suspect accesses arguments by index rather than by name, the answer is yes.

Upvotes: 0

Tushar Gupta
Tushar Gupta

Reputation: 15923

The RFC does not say anything about this, and for most intents and purposes I'd say they're the same (for most applications), but the application has access to the query string as is, and can act differently and accordingly

Upvotes: 1

xanatos
xanatos

Reputation: 111920

I'll say the opposite from Christos. Theorically they are equivalent, but you specified Asp.net. In Asp.net you use Request.QueryString to access the query strings. It is a NameValueCollection, that is an indexed collection (you can do Request.QueryString[0], Request.QueryString[1]...) . So a (badly) written page could "think" a key always has a fixed index.

Upvotes: 5

Joehl
Joehl

Reputation: 3701

There are not the same, because the parameters are not in the same order =)

But in most cases, there is no difference in handling this. When you want to read the parameter-values, the order is not important (only the name).

Upvotes: 1

Christos
Christos

Reputation: 53958

Are the below mentioned two URLs same?

It is exactly the same. Provided that you have given the names you use in your server side code, you will not experience any issue with the order of the parameters.

Upvotes: 2

Related Questions