I am using the following example :
http://angular-ui.github.io/ui-router/sample/#/
Default Page URL in the example above :
http://angular-u
The issue is on the ASP.NET MVC side... we have to be sure, that
This should be the content of your Index action
public ActionResult Index()
{
var root = VirtualPathUtility.ToAbsolute("~/");
var applicationPath = Request.ApplicationPath;
var path = Request.Path;
var hasTraillingSlash =
root.Equals(applicationPath, StringComparison.InvariantCultureIgnoreCase)
|| !applicationPath.Equals(path, StringComparison.InvariantCultureIgnoreCase);
if (!hasTraillingSlash)
{
return Redirect(root + "#");
}
return View();
}
Check this Q & A:
First, I'm change the templateUrl to
templateUrl: '/Scripts/ui-route/home/home.html',
Then, I changed the code as follows:
public ActionResult Index()
{
var path = Request.Path;
if (path == "/Admin")
{
return Redirect("/Admin/");
}
return View();
}
It works.