Building URL or link in REST ASP.NET MVC

Posted by AWC on Stack Overflow See other posts from Stack Overflow or by AWC
Published on 2010-03-18T21:31:50Z Indexed on 2010/03/18 21:51 UTC
Read the original article Hit count: 401

Filed under:
|
|
|
|

I want to build a URL at runtime when a resource is render to either XML or JSON. I can do this easily when the view is HTML and is rendering only parts of the resource, but when I render a resource that contains a links to another resource I want to dynamically generate the correct URL according the host (site) and resource specific URI part.

<components>
   <component id = "1234" name = "component A" version = "1.0">
       <link rel = "/component" uri="http://localhost:8080/component/1234" />
   </component>
<components>

How do I make sure the 'uri' value is correct?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about mvc