Rauf
Rauf

Reputation: 12852

ASP.NET QueryStrings

Is there any conventions should I follow while using QueryStrings in ASP.NET? For eg: which is better one? 1 or 2 ? 1. url?stock_trnasfer_ID=10 2. url?sid=10

Upvotes: 0

Views: 135

Answers (3)

Kadir
Kadir

Reputation: 3224

Always second one. Because url must be short for users.

Upvotes: 1

Azhar
Azhar

Reputation: 20678

Its depends on programmer but if there are many values then you should go for second option

2. url?sid=10

because URl has length limitation and you have to add some other in future then it will be difficult to handle.

but if only one or two then you can go for the 1 option

1. url?stock_trnasfer_ID=10

comprehensive for developer(you) but not informative to users because in this case its more helpful for hackers that you are passing an ID, so should not give idea to users that what you are passing in Querystrings.

Upvotes: 0

Jagmag
Jagmag

Reputation: 10366

I would go with option 2.

Reason:

  1. Querystrings have limited size (though its quite large nowadays) so better to not waste it with long names

Upvotes: 1

Related Questions