Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Url helper for full url in asp.net mvc-3

Tags:

Writing

@Url.Content("~/Something/Something.html") 

in razor renders

/AppFolder/Something/Something.html 

Is there a way to render the full URL like http://www.something.com/AppFolder/Something/Something.html without atrocious hacks? (like storing the protocol and domain in the AppConfig, and concatenate the string to it)

Is there a helper like @Url.FullPath("~/asdf/asdf") or similar?

like image 358
vinczemarton Avatar asked Aug 17 '11 08:08

vinczemarton


1 Answers

See this blog post for the answer.

Basically, all you need to do it include the protocol parameter e.g.

Url.Action("About", "Home", null, "http") 
like image 108
ETFairfax Avatar answered Oct 23 '22 21:10

ETFairfax