Avatar of nicedone
nicedone
 asked on

can you explain me how to pass query string parameter in url vs. passing parameter as example /param1/2

hi,

i am trying to learn if i want to pass a parameter as param1/3   vs replies?param1=3

i would like to learn how to generate each of them what should i do, and which 1 i should prefer in my coding?

thanks
C#Web DevelopmentASP.NET

Avatar of undefined
Last Comment
Alexandre Simões

8/22/2022 - Mon
Alexandre Simões

The first one is the classic querystring way supported natively by ASP.net:
replies?param1=3

The second is based on routes, which is a commonly used in the MVC designs.
You can still use routes in ASP.net webforms, but ASP.net MVC makes it easier to implement.

So to put it simple, the choice is much related to how you want to build your site, Web Forms or MVC? :)
nicedone

ASKER
thanks for the explaination,

1) if i use mvc which i do at the moment and prefer to pass in

replies?param1=3 can i do that? if so could you show a little code snippet that accomplishes that

if i want to use param1/3 as in routes could you share a small code to accomlish that insted too
ASKER CERTIFIED SOLUTION
Alexandre Simões

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Your help has saved me hundreds of hours of internet surfing.
fblack61