开发者

Static pages in ASP.NET MVC

开发者 https://www.devze.com 2023-04-12 07:28 出处:网络
Suppose that your ASP.NET MVC website contains a handful of dynamic pages and a big amount of static pages that of course need the Login & Register link on the top right corner. How do you handle

Suppose that your ASP.NET MVC website contains a handful of dynamic pages and a big amount of static pages that of course need the Login & Register link on the top right corner. How do you handle this?

We have converted the HTML pages to ASPX and introduced the ASP.NET code to display the user name but I am not sure that it's the best approach. In addition we needed to move static pages to a different folder to avoid collision with MVC routing.

Is this the best that can be done?

Th开发者_开发知识库anks.


ASP.NET MVC and Web Forms can live together with no problem. If your approach is working out for you then it should be fine.

Also see the below article. It might help :

Integrating ASP.NET MVC 3 into existing upgraded ASP.NET 4 Web Forms applications

http://www.hanselman.com/blog/IntegratingASPNETMVC3IntoExistingUpgradedASPNET4WebFormsApplications.aspx


I believe as long you implement Donut caching within the ASP.Net pages you can get similar performance as static html pages.


If you use IIS Form Athentication for your site static content can be accessed only if the user is authenticated, so you can mantain HTML files and do not convert them in ASPX, but you need to add some javascript to hide the login link and display username (you can check the auth cookie of IIS or create your custom cookie).


Have you considered some client side script that loads the username/password section you need?

You could have it load a view and inject it into a div. Then you have a single point to maintain for all the static content.

0

精彩评论

暂无评论...
验证码 换一张
取 消