0

I have this existing application now user wants me to add a new page.But URL should be same. i.e.there is already a view name Index.

http://www.localhost/Index?mdn=&Mdn wdate=&Wdate

Now user wants me to add a new view named Count but they wants url should be like this.(except one query string.)

http://www.localhost/Index?mdn=&Mdn count=&Count

I am new in asp.net MVC. Please help thanks.

2 Answers 2

1

There is several ways to achieve that. One way is using RedirectToAction():

public ActionResult Index(string count)
    {
        if (count == "Count")
            return RedirectToAction("newActionMethod"); 

        // ... other codes ...
        return View();
    }
Sign up to request clarification or add additional context in comments.

Comments

1

In your controller action, you can choose which view to render:

public ActionResult Index(...)
{
  if (...)
    return View("Count");

  return View(); // returns the default view (in this case "Index")
}

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.