How to define using statements in web.config?

Posted by Hasan Gürsoy on Stack Overflow See other posts from Stack Overflow or by Hasan Gürsoy
Published on 2010-04-16T11:33:17Z Indexed on 2010/04/16 11:43 UTC
Read the original article Hit count: 261

I'm using MySql in my asp.net project. But I don't want to type every "using MySql.Data.MySqlClient;" statement in every aspx.cs file. How can I define this lines in web.config file?

I've defined some namespaces like below but this only works for aspx pages:

<?xml version="1.0"?>
<configuration>
    <system.web>
        <compilation debug="false" targetFramework="4.0"/>
        <pages>
            <namespaces>
                <add namespace="System.Web.Configuration"/>
                <add namespace="MySql.Data"/>
                <add namespace="MySql.Data.MySqlClient"/>
            </namespaces>
        </pages>
    </system.web>
</configuration>

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about .net-4.0