0

In get action method i'm returning view and passing model to it.

return View("MyView", model);

Then i get required view with model details in url.

host:/response?id=1&otherId=2 ...

I want to have next url:

host:/response

How to get it? Or how to map route the way i wanted?

1 Answer 1

1

in your solution explorer, go to App_Start folder. in that folder open RouteConfig.cs file. Open it. You will show something like

routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Shared", action = "WelcomeView", id = UrlParameter.Optional }

change url: as you want to show. If you dont want to see id in your url, i recommend you to make a new MapRoute and dont include id in it

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.