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