简体   繁体   English

如何使MVC URL始终为“ www.domainname.com”?

[英]How to make MVC URL always “www.domainname.com”?

I seem to remember in an MVC training class I took that you could hide the {controller}/{action}/{parameter} from the user, so they could only see the site domain... 我似乎记得在一次MVC培训班中,我参加过一次培训,您可以向用户隐藏{controller} / {action} / {parameter},因此他们只能看到站点域...

Do you know if this is possible? 你知道这有可能吗? How to do it? 怎么做? Or keywords that I could search further on? 还是我可以进一步搜索的关键字?

I basically have buttons on each View of my project that are Back/Next, these buttons in their javascript file are basically: window.href("pageToGoto"), I would still want this functionality to exist, but I don't want the user to see the pages in the URL. 我基本上在项目的每个视图上都有“后退/下一步”按钮,它们的javascript文件中的这些按钮基本上是:window.href(“ pageToGoto”),我仍然希望此功能存在,但是我不希望用户以查看URL中的页面。

Thanks for any advice. 感谢您的任何建议。

You could use MVC and make a single page application (SPA). 您可以使用MVC并制作一个单页应用程序(SPA)。 SPA Tutorial links a tutorial that shows how to make such an application using ASP.net web api and angular.js. SPA教程链接了一个教程,该教程显示了如何使用ASP.net Web API和angular.js制作这样的应用程序。

Keep in mind thought, SPA's are not great for bookmarking, SEO, etc. as mentioned in an above comment so I'd think about it and make sure this is really the design pattern you need. 请记住,如上面的评论中所述,SPA不适用于书签,SEO等,因此我会考虑一下,并确保这确实是您需要的设计模式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在asp.net mvc域名/用户名中进行路由,这样每个用户都有像facebook这样的“用户名” - How to make routing in asp.net mvc domainname/username so each user has his “username” like facebook does 如何获取http://www.google.com网站的重定向网址 - How to get redirect url of http://www.google.com site 如何创建www.domain.com/product MVC路由 - How to create www.domain.com/product MVC route 我想使用Url.action在mvc中的www.mysite.com/home/details/1/lesson1中创建Create Url - I want Create Url like in www.mysite.com/home/details/1/lesson1 in mvc with Url.action 如何使用www.addthis.com - How to use www.addthis.com 我想解析这个网站 url "https://www.171chryslerdodgejeepram.com/" 来获取 DealerId 的值,但我不知道该怎么做 - I want to parse this website url "https://www.171chryslerdodgejeepram.com/" to get value of DealerId but I have no idea how to do it 如何在网址中添加www并重定向? - How to add www to url and redirect? 如何将www.example.com重定向到example.com? - How to redirect www.example.com to example.com? 路线网址,例如http://www.example.com/{userId} - Route URL such as http://www.example.com/{userId} 无法在MVC C#中从www.domain.com重定向到domain.com - not able to redirect from www.domain.com to domain.com in MVC C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM