ASP. NET mvc3 razor debugging and pre-loading

Source: Internet
Author: User

In ASP. NET mvc3 development, debugging is indispensable. for developers who use razor,

This section describes how to debug this module.

Debugging in mvc3 razor

As you know, debugging for published websites is often very tragic.

Look at the powerful print functions in razor.

@ Objectinfo. Print (this. Context. User)

 

Obtain Server Information

@ Serverinfo. gethtml ()

 

Formsauthentication. slidingexpiration attribute

Gets a value indicating whether to enable the sliding duration.

The slidingexpiration attribute value is set by using the slidingexpiration feature of the forms configuration element.

If a request is sent and the timeout interval is more than half, the expire function will reset the expiration time of the valid authentication cookie. If the cookie expires, the user must re-verify the identity. If the slidingexpiration attribute is set to false, the validity period of the authentication cookie can be limited by the configured timeout value, thus improving application security.

If you set requiressl to false, we recommend that you set slidingexpiration to false to shorten the validity period of the ticket.

Mvc3 pre-load

3.1 after the program is started for the first time, run _ appstart. cshtml in the root directory.

(If we can also write a hard code in Code 3.1, the 3.2 feature will be even better !)

3.2 execute _ viewstart. cshtml in the folder each time you enter the folder.

 

Note:

Suppose weFirst timeAccess the index. cshtml page under cahe and perform the operation as shown in the figure above.

However, if it is not the first access to 1, it will be skipped. Every time a file enters the cahe directory, it will execute _ viewstart. cshtml in 3.

This provides a lot of convenience for our operations.

For example, you can set global cache and variables in 1, such as online statistics,

Copyright information, mailbox settings, and so on.

In section 2, we separately set access permissions or themes for pages in a specific folder.

This section describes ASP. NET mvc3 razor debugging and pre-loading.

Asp.net mvc3, mvc3
Razor, mvc3 debugging and pre-loading

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.