Web. config usage tips)

Source: Internet
Author: User
Tags connectionstrings
Link: http://scottwater.com/blog/archive/asp-net-web-config-tips-part-two/

1. Set DEBUG = "false" when releasing a product" <Compilation defaultlanguage = "C #" DEBUG = "false"/>

The disadvantage of true in debug is that the compilation page takes longer time, the code execution time is longer, and more memory is used during running.
2. If you cannot manage the product running environment, set the Program trust level to medium. <Trust level = "medium"/>

As more and more ISPs set the Asp.net trust level to medium, there are many things that cannot be done at this trust level.
3. Disable session state if no session is needed. <Sessionstate mode = "off"/>

Otherwise, the session information is included in each request.
4. Disable viewstate <Pages enableviewstate = "false"/>

5. Define custom controls so that they can be directly used on each page. <Pages>
<Controls>
<Add tagprefix = "cscontrol" namespace = "communityserver. Controls" assembly = "communityserver. Controls"/>
</Controls>
</Pages>

6. Define User Controls <Pages>
<Controls>
<Add tagprefix = "Monroe" tagname = "postview" src = "~ /Controls/postsview. ascx "/>
</Controls>
</Pages>

7. Use the configsource attribute <Connectionstrings configsource = "connectionstrings. config"/>

8. Use ashx instead of httphandlers <% @ Webhandler Language = "C #" class = "communityserver. Blogs. components. weblogrsshandler" %>

Ashx is suitable for processing RSS or images for a single purpose.

Related Article

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.