0

In my mvc2 project, some URL are shown in the browser like this,

localhost:53289/Paper/ViewAgendaPaper?MeetingId=186&type=2&RefId=186

but i prefer to look it like this,

localhost:53289/Paper/ViewAgendaPaper

In my Global.asax,

routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Default", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

How to hide the id fields in the URL. Please give me some idea. Thankyou.

2 Answers 2

3

As far as I think you can't hide the Ids as they are supposed to be passed to fetch the exact data, however instead of

localhost:53289/Paper/ViewAgendaPaper?MeetingId=186&type=2&RefId=186

you can have it like:

localhost:53289/Paper/ViewAgendaPaper/186/2/186

Going through this post will help you more: How can I create a friendly URL in ASP.NET MVC?

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

1 Comment

The place where you are making the above link, simply change it and make it to appear like the one i told you and things will work fine.
1

You cannot do what you are asking for with a simple link. An anchor link <a>...</a> performs a simple GET. If you want to hide the parameters, you would need to do a POST to the page in question.

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.