Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jun 11, 2012 11:14 AM by gaikwad_anil1987
Contributor
2805 Points
534 Posts
May 06, 2012 03:36 PM|LINK
Is it possible to define common namespaces in web.config so that I won't have to define it in every page like I have System.Data.OracleClient which i don't want to define or Import in every page
2230 Points
453 Posts
May 06, 2012 03:54 PM|LINK
Yes I think you can do it.
You need to use namespace tag for this
<pages> <namespaces> <add namespace="System" /> <add namespace="System.Collections" /> <add namespace="System.Collections.Specialized" /> <add namespace="System.Configuration" /> <add namespace="System.Text" /> <add namespace="System.Text.RegularExpressions" /> <add namespace="System.Web" /> <add namespace="System.Web.Caching" /> <add namespace="System.Web.SessionState" /> <add namespace="System.Web.Security" /> <add namespace="System.Web.Profile" /> <add namespace="System.Web.UI" /> <add namespace="System.Web.UI.WebControls" /> <add namespace="System.Web.UI.WebControls.WebParts" /> <add namespace="System.Web.UI.HtmlControls" /> </namespaces> <!-- Other elements --> </pages>
More information here : http://msdn.microsoft.com/en-us/library/ms164642.aspx
May 07, 2012 03:35 PM|LINK
I tried it but it is not working...
any other method
Participant
1472 Points
228 Posts
May 11, 2012 07:10 AM|LINK
HI
Why you want it in web.cofig file?
VBproj or csproj file can achieve this..
May 11, 2012 08:34 AM|LINK
so that i don't have to define it in every page
Jun 11, 2012 11:14 AM|LINK
aI found out that it is only applicable to .aspx file whatever you define in web.config can be accessed in .aspx file only
gaikwad_anil...
Contributor
2805 Points
534 Posts
Define common namespaces in web.config
May 06, 2012 03:36 PM|LINK
Is it possible to define common namespaces in web.config so that I won't have to define it in every page like I have System.Data.OracleClient which i don't want to define or Import in every page
www.thecodekey.com
Please mark as answer if useful
vsdev
Contributor
2230 Points
453 Posts
Re: Define common namespaces in web.config
May 06, 2012 03:54 PM|LINK
Yes I think you can do it.
You need to use namespace tag for this
<pages> <namespaces> <add namespace="System" /> <add namespace="System.Collections" /> <add namespace="System.Collections.Specialized" /> <add namespace="System.Configuration" /> <add namespace="System.Text" /> <add namespace="System.Text.RegularExpressions" /> <add namespace="System.Web" /> <add namespace="System.Web.Caching" /> <add namespace="System.Web.SessionState" /> <add namespace="System.Web.Security" /> <add namespace="System.Web.Profile" /> <add namespace="System.Web.UI" /> <add namespace="System.Web.UI.WebControls" /> <add namespace="System.Web.UI.WebControls.WebParts" /> <add namespace="System.Web.UI.HtmlControls" /> </namespaces> <!-- Other elements --> </pages>More information here : http://msdn.microsoft.com/en-us/library/ms164642.aspx
Blog: dotnetthoughts
Download Capture It Plus
gaikwad_anil...
Contributor
2805 Points
534 Posts
Re: Define common namespaces in web.config
May 07, 2012 03:35 PM|LINK
I tried it but it is not working...
any other method
www.thecodekey.com
Please mark as answer if useful
SonicMan
Participant
1472 Points
228 Posts
Re: Define common namespaces in web.config
May 11, 2012 07:10 AM|LINK
HI
Why you want it in web.cofig file?
VBproj or csproj file can achieve this..
gaikwad_anil...
Contributor
2805 Points
534 Posts
Re: Define common namespaces in web.config
May 11, 2012 08:34 AM|LINK
so that i don't have to define it in every page
www.thecodekey.com
Please mark as answer if useful
gaikwad_anil...
Contributor
2805 Points
534 Posts
Re: Define common namespaces in web.config
Jun 11, 2012 11:14 AM|LINK
aI found out that it is only applicable to .aspx file whatever you define in web.config can be accessed in .aspx file only
www.thecodekey.com
Please mark as answer if useful