7

I wanted to get some expert suggestions on designing urls for our web app. This is not a public domain website, it is a supplychain intranet based web-app used only by a group of authenticated users.

Here're some examples -

/Claim/12/Manage
FORMAT: controller/{ID}/action

The url that points to a "Claim Entry" wizard. Here "12" is the ClaimID. It is further divided into tabs for sub-data entry. Example: /Claim/12/Print, /Claim/12/FileDetails, ...

/Users/List
FORMAT: controller/action

Display's a list of existing users in Grid. Shud this be shortened to "/Users" ? Likewise we've some other entities as well like "Roles, Organizations, etc..."

/Master/Manage/FileType
FORMAT: controller/action/{argument}

We've a page which allows he user to manage different master table data. Need to know which master table is selected (i.e. sent as argument). Is it better to simplify it as "/Manage/{argument}" instead and then map that url as required above?

  • Is it sensible in MVC to hide default actions like "Claim/21/Manage" shud be "Claim/21", "/Users/List" shud be "/Users" ...
  • Arguments - are they better as embedded in url or good to append as query-string

Any generic guidelines or references would also be great.

Ref: Web services url - (Section: Designing the URI Templates) http://msdn.microsoft.com/en-us/library/dd203052.aspx

2 Answers 2

2

You can use Regular Expressions to represent various routes you have. For example

protected void Application_Start()
{
RouteTable
.Routes
.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL template
new { controller="Mycontroller", action="Myaction", id=UrlParameter.Optional },
new { action = @"\d{2}-\d{2}-\d{4}" }
);
}
Sign up to request clarification or add additional context in comments.

Comments

1

Well, I conclude that this one is the best (and probably the most detailed) explanation I can find on MSDN - http://msdn.microsoft.com/en-us/library/dd203052.aspx

And that shud be sufficient :-)

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.