The Asp.net configuration file references the type in app_code.

Source: Internet
Author: User

In ASP. create a web site in net2.0. At this time, some business code written will be put into app_code (it seems that you do not recognize @ _ @). At the same time, we do not want to create another project to reference it. for websites. if config wants to use the objects in the site for configuration, how can it be done.

For example, we create a custom configuration section.

Namespace greystar. config
{
Public class mysection: configurationsection

{

The code is saved. Just an example ....

}

}

 

Now, how do we write this custom configuration.

<Configsections>
<Section name = "mydemo" type = "greystar. config. mysection, XXXX"/>
</Configsections>
We usually know that the format of type is type name, DLL name (without suffix ). for ASP. for net2.0 websites (non-applications), it is not clear that n dll files are generated. so how can we reference it.

In fact, this problem is very simple.

Take a look at the correct answer

<Configsections>
<Section name = "mydemo" type = "greystar. config. mysection, _ code"/>
</Configsections>

You can use the built-in types with the keyword _ code.

 

At the same time, if a Custom User Control is written in app_code<% @ Register tagprefix = "XX" namespace = "XX" assembly = "_ code" %>

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.