Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
My MVC 5 application is hosted in a subdomain. When making an ajax call to the MVC action method, how to specify the URL ? , ie without hardcoding the base URL , now the ajax call which is working in the development is not working in production. I understand it can be done using attribute routing in MVC 5
Posted
Updated 21-Dec-15 19:48pm
v3
Comments
Suvabrata Roy 22-Dec-15 4:24am    
string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~")); it provide the current URL of your Sub Domain now append your action to it
Nathan Minier 22-Dec-15 7:33am    
Is your script on a Razor(cshtml) page? if so, you can use @Url.Action().

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900