Hi Nathan/Dave,
This seems to work but seems ugly:
string returnURI =
HttpContext.Request.Url.AbsoluteUri.Replace(HttpContext.Request.Url.AbsolutePath,"")
+ Url.Action("SomeAction", "SomeController");
I need to generate it based on where the site is deployed but it needs to be a
full URL as it’s passed to a callback function on another site.
Regards,
Greg
Dr Greg Low
1300SQLSQL (1300 775 775) office | +61 419201410 mobile│ +61 3 8676 4913 fax
SQL Down Under | Web: <http://www.sqldownunder.com/> www.sqldownunder.com
From: [email protected] <mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Dave Walker
Sent: Friday, 12 April 2013 5:43 PM
To: ozDotNet
Subject: Re: MVC4 URLs
We use a helper extension method to wrap as have configurable cdn esp. for
images and other static resources. Was the only way we found we could do it.
Extra complexity for us is we wrap a SquishIt bundle up as well to turn on/off
minification and combination of files.
On 12 Apr 2013, at 08:32, Nathan Schultz <[email protected]
<mailto:[email protected]> > wrote:
Instead of using Url.Action, couldn't you just write your own <a href>?
On 12 April 2013 11:17, Greg Low (GregLow.com <http://GregLow.com> )
<[email protected] <mailto:[email protected]> > wrote:
Hi Folks,
In MVC4, in the code for a controller, what’s the best way to calculate the
fully qualified URL for a particular action?
Eg: If I use
Url.Action(“SomeAction”,”SomeController”)
The intellisense for Action says “gets a fully qualified URL”. However what I
get back is:
/SomeController/SomeAction
What I want is:
http://www.whateversiteIhit.com/SomeController/SomeAction
<http://www.somesite.com/SomeController/SomeAction>
As I need to pass it to an external callback.
What’s the best way to do that?
Regards,
Greg
Dr Greg Low
CEO and Principal Mentor
SQL Down Under
SQL Server MVP and Microsoft Regional Director
1300SQLSQL (1300 775 775) office | <tel:%2B61%20419201410> +61 419201410
mobile│ <tel:%2B61%203%208676%204913> +61 3 8676 4913 fax
Web: <http://www.sqldownunder.com/> www.sqldownunder.com