【发布时间】:2015-07-06 23:44:38
【问题描述】:
我的查询与 Rewrite AngularJS URL 完全相同,但我使用 IIS 作为我的 Web 服务器。
如何修复网址?目前我的网址看起来像
http://example.com/app#/
需要像这样改变
http://example.com/app/#/
【问题讨论】:
标签: angularjs angular-ui-router
我的查询与 Rewrite AngularJS URL 完全相同,但我使用 IIS 作为我的 Web 服务器。
如何修复网址?目前我的网址看起来像
http://example.com/app#/
需要像这样改变
http://example.com/app/#/
【问题讨论】:
标签: angularjs angular-ui-router
如果我们使用 ASP.NET MVC 运行时来触发 HomeController 上的 Index 操作以充当“index.html”(返回视图 index.cshtml) - 我们只需将这些行添加到其中:
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();
}
查看Browser address will not be displayed correctly in ui-route
【讨论】: