I have an ASP.NET MVC login page and on login button click, it is redirecting to another page which is connected with angular, Once I logged in, the url redirecting me to something like below
http://localhost:5083/Home#/home
I need to remove the ASP MVC controller name ("Home") from the Url, how can i do that?
Login page location - AccountContrller->Index.cshtml and on login button click it moved to HomeController -->index.cshtml
更新你的MVC默认路由,使其指向Home控制器和操作作为索引 - 所以当请求来自localhost:5083时,mvc将控制器解析为Home并将操作解析为Index,这将引导angularjs路由引导。
In the page provided by MVC (Home/Index.cshtml), if you set the Base Href to /Home then angular2 will be able to route everything relative to /Home and then you don't need to remove /Home from the URL, so at the top of Index.cshtml add:
<head>
<base href="/Home/"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.