1

When typing in my URL SalaryFor/Microsoft/Balmer i need to display salary for user with name Balmer and if I type in URL SalaryFor/Microsoft i need to display salary for all employee in Microsoft company

Is it possible? because when I use this link SalaryFor/Microsoft/Balmer all works fine

public ActionResult Salary(string company, string person)

both company and person contains values

but this link does not work SalaryFor/Microsoft

public ActionResult SalaryFor(string company, string person)

both values contains null

my route in global.asax is

    routes.MapRoute("Salary",
                    "{controller}/{action}/{company}/{position}",
                    new
                        {
                            controller = "Salary",
                            action = "SalaryFor",
                            company = "",
                            test = ""
                        });

O maybe I am making something wrong? Thanks, Alexander.

1 Answer 1

2

You need to map a second route.

routes.MapRoute("Salary2",
                    "{controller}/{action}/{company}",
                    new
                        {
                            controller = "Salary",
                            action = "SalaryFor",
                            company = ""
                        });
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.