BC30456: 'InitializeCulture' is not a member of FIXES
Windows 2003 Server SP1, ASP.Net 2.0
BC30456: 'InitializeCulture' is not a member of
Have a bug in your code but throws this error instead of the actual error? Or getting this error randomly? Or a similar error complaining that an asp.net method is not a member of a class like 'Page' when it is!? and mashing refresh a few times sometimes makes it go away...
After 2 Days of extensive search on the internet and finding plenty of people with this error and very little replies and resolutions, I took upon myself to get to the bottom of this (unacknowledged ASP.net framework bug) and list some steps to help all of you work around it.
1. If you use Visual studio to publish your site, during the publishing stage on framework 2.0 uncheck the "allow this precompiled site to be updatable".
2. Ensure ASP.Net is installed correctly, I found that my Web Server root was configured to use ASP.Net 1.1 by default so ran the following line to fix it to 2.0 even though my site was configured for 2.0 at site level, eliminating this glitch seems logical.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -i
This will also fix any mapping/installation problems.
Also ran aspnet_regiis -r
This will replace all mappings recursively to 2.0 regardless.
3. Make sure page directives at the top of aspx files are correct and ‘inherits’ is pointing to your class correctly. I could not see any problems with mine, so did not explore down this path to thoroughly, but noted others saying issues with ambiguous inheritance maybe related.
4. Declare culture in your web.config, example
<globalization uiCulture="en" culture="en-NZ" />
OR
<globalization uiCulture="auto" culture="auto" />
5. Change debug="true" to "false" in web.config and any pages which have it set (I recommend removing it entirely from pages and just using web.config)
* This final step eliminated the problem for me, very weird.
Now if this last step eliminates the problem, and later on down the track you get an error in your codebehind file while coding or debugging, you will no longer be pointed directly to the line in your codebehind file when an exception occurs, asp.net will just show you the line in the aspx file you called from. Temporarily switch debug back to true in web.config if you can't figure out the problem and then you can see it, if InitializeCulture crops back up instead, mash refresh a few times like you used to do! Then turn debug back off.
---
Does anyone else have anymore info?
My question to Microsoft, why does this behaviour exist? Is it by design or really a bug? If so, why is there no acknowledgment of it as a bug for ASP.Net 2.0?
-juicyjuice
Answers
- Another cause: remember to clear the application's bin directory on the target server before updating with a new version of your app. Leftovers from a previous VS "publish" is a possible cause of this error.
Thanks for this post! I too had a hard time figuring this out... Unfortunately, I tried your steps above and none of them worked. They did point me to a solution though:
We were trying to publish our ASPX pages to a mixed site; some DLL's had been compiled in .NET 1.1, and we were moving to 2.0. All of our pages with code-behind derived from our own custom Page class, and I realized that simply upgrading the site to 2.0 would not force a rebuild of those original DLL's (on top of which all the ASPX pages sat). My understanding of the page build lifecycle is that the JIT .NET compiler won't rebuild anything unless the files actually change - in this case the ASPX was different, but not the parent class (in our 1.1 DLL's), so while the page was being rebuilt it was attempting to bind to an older compilation of the parent class that did not have the new 2.0 bindings to culture information.
So, we simply rebuilt the 1.1 DLL's (using VS 2003 - NOT VS 2005 - they are still 1.1) and republished to the bin folder, and then the problem disappeared.
It makes sense, because the original compilation in 1.1 would have still been there, and obviously none of the new 2.0 stuff - like Culture enhancements - would be there. Forcing .NET to recompile the base libraries resolved it for us.
Your generated aspx files are all using the same CodeFile, yes? From what I'm understanding you can not have multiple aspx files using the same codefile! It seems weird, but this error seems to start occurring when more and more aspx files are using the same codefile.
Thanks! This is what exactly got me - it took me hours before I see your post.
Sometimes I copy and rename a *.aspx and *.aspx.vb before I make some major changes, then go on making the changes with my new copy. I didn't realized in the backup file, it's still pointing to the old Code File. If that's the case, and if you indeed add any new control in the new copy file, then during build it will give this BC 30456 error that XXX is not a member of XXX. And it is true that the new control doesn't exist in the backup *.aspx file. So be careful not to make the same mistake.
All Replies
Dear JuicyJuice,
Thanks for your post - until I read this I thought I was going crazy.
Step 5 was the last stage that fixed the problem for me too. Many thanks!
Thanks for this post! I too had a hard time figuring this out... Unfortunately, I tried your steps above and none of them worked. They did point me to a solution though:
We were trying to publish our ASPX pages to a mixed site; some DLL's had been compiled in .NET 1.1, and we were moving to 2.0. All of our pages with code-behind derived from our own custom Page class, and I realized that simply upgrading the site to 2.0 would not force a rebuild of those original DLL's (on top of which all the ASPX pages sat). My understanding of the page build lifecycle is that the JIT .NET compiler won't rebuild anything unless the files actually change - in this case the ASPX was different, but not the parent class (in our 1.1 DLL's), so while the page was being rebuilt it was attempting to bind to an older compilation of the parent class that did not have the new 2.0 bindings to culture information.
So, we simply rebuilt the 1.1 DLL's (using VS 2003 - NOT VS 2005 - they are still 1.1) and republished to the bin folder, and then the problem disappeared.
It makes sense, because the original compilation in 1.1 would have still been there, and obviously none of the new 2.0 stuff - like Culture enhancements - would be there. Forcing .NET to recompile the base libraries resolved it for us.
- I had this same problem and I narrowed it down to pages that were upgraded from VS 2003. I deleted the NameSpace that the upgrade wizard created in each file then modified the inherits value. This seemed to correct the problem.
I've tried all of the above mentioned fixes to this, but it keeps coming back. The frustrating thing is that it is intermittent, i.e., one page will be working, then after a time, it'll not work, but another which didn't work will start working.
My situation is different slightly to those above, as they all seem slightly different from each other. I have a web app which I've built which has a very simple CMS. When a new page is added in through the CMS, it copies the existing "Pages.aspx" file which just has a couple of web user controls for the content dynamically added to it at run time.
The File name is stored in the database, as is the content which is rendered in the Web User Controls, then at run time, the page is requested, and it loads the code behind of pages.aspx which gets the apropriate content from the database based on the name of the page being requested, so we have a file which is pages.aspx which has
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="pages.aspx.vb" Inherits="Pages" MasterPageFile="~/atzmi.master" %>
<%@ Register Src="WUCLeftNav.ascx" TagName="WUCLeftNav" TagPrefix="uc1" %>
<%@ Register Src="WUCMultiRowTemplate.ascx" TagName="WUCMultiRowTemplate" TagPrefix="MRT" %>
<%@ Register Src="WUCStandardTemplate.ascx" TagName="WUCStandardTemplate" TagPrefix="SDT" %>
<asp:Content runat="server" ID="content1" ContentPlaceHolderID="ContentPlaceHolder1">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" style="height: 15px">
<asp:PlaceHolder runat="server" ID="plhLeftNav" EnableTheming="false" />
</td>
<td valign="top" style="height: 15px">
<asp:PlaceHolder runat="server" ID="plhContent" EnableTheming="False" />
</td>
</tr>
</table>
</asp:Content>Each ofthe other content pages ends up identical except of course for the file name. This means that a file called "AboutUs.aspx" would have Inherits"Pages" This works fine in the development environment, but after using the Visual Studio Publish function, these pages load sometimes, or sometimes not.
Could we please have a response to this from Microsoft so that this issue can be put to bed finally. Any response would be better than the silence there seems to be around it.
Thank you,
Dawson.
- Hi Dawson,
Since making the above posting, I have discovered more information about number (3) ambiguous inheritance, which is my issue and by the sounds of it yours too. I'm going to be updating my post in the next few days with new information relating to the inheritance system and how pages are compiled under vs 05 and .Net 2.0 vs 1.1
Your generated aspx files are all using the same CodeFile, yes? From what I'm understanding you can not have multiple aspx files using the same codefile! It seems weird, but this error seems to start occurring when more and more aspx files are using the same codefile.
Yeh would be nice to get some official help, trust me, I've tried all avenues. - Another cause: remember to clear the application's bin directory on the target server before updating with a new version of your app. Leftovers from a previous VS "publish" is a possible cause of this error.
Your generated aspx files are all using the same CodeFile, yes? From what I'm understanding you can not have multiple aspx files using the same codefile! It seems weird, but this error seems to start occurring when more and more aspx files are using the same codefile.
Thanks! This is what exactly got me - it took me hours before I see your post.
Sometimes I copy and rename a *.aspx and *.aspx.vb before I make some major changes, then go on making the changes with my new copy. I didn't realized in the backup file, it's still pointing to the old Code File. If that's the case, and if you indeed add any new control in the new copy file, then during build it will give this BC 30456 error that XXX is not a member of XXX. And it is true that the new control doesn't exist in the backup *.aspx file. So be careful not to make the same mistake.yes, clearing the app bin fixed it for me
:)
- Excellent. Step 1 solved the entire problem.
- Great Post, did a search for matching Inherits and found it right away.
I was confused, attempted most steps, but what worked for me was removing my code from its initial NameSpace and then refering to the classes by their full name, i.e. namespace.classname.
hope this helps some people.
- Thank you so much for taking the time to post this. I was able to find this thread when Googling for the error I received after publishing a blog to my hosting provider.
Your #4 worked for me. I replaced my globalization line in my web.config file with:
Thanks again for the help!Code Snippet<globalization requestEncoding="utf-8" responseEncoding="utf-8" uiCulture="auto" culture="auto" />

Thanks so much for your generous contribution! You're a life saver.
--Karl
Here is another situation in which the 'InitializeCulture' is not a member of... error occurs. This one applies to those of us who write ASPX pages without using the Visual Studio environment. I wanted to include a very short javascript in my ASPX page. So I blithely wrote the following code:
HttpContext.Current.Response.Write("<script language=javascript>")
HttpContext.Current.Response.Write(... a few lines of javascript code...)
HttpContext.Current.Response.Write("</script>")
It threw the error until I re-wrote this as:
HttpContext.Current.Response.Write(chr(60) & "script language=javascript" & chr(62))HttpContext.Current.Response.Write(... a few lines of javascript code...)
HttpContext.Current.Response.Write(chr(60) & chr(47) & "script" & chr(62))
For me it was due to the fact that I copied and pasted an APS.Net page with a codebehind page. When I renamed the APSX, it automatically renamed the aspx.vb file. The problem was that the partial class was duplicated. It worked in the runtime environment, but not once I published it to the Web server.
Once I changed the name of the partial class in the codebehind file, and the corresponding inherits statement in the aspx, It worked fine.
Another solution.
step1: Search you pages where the error occured, switch to [source]
check the 1st line, for example the page name is MyHistory.aspx, the 1st line shoud be like blow:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="MyHistory.aspx.vb" Inherits="MyHistory" %>
step2: Switch to source code page ,in this sample is MyHistory.aspx.vb, check the 1st line , it likes blow
Partial Class MyHistory
If there is any difference between them, fix it to the right name, I think the problem will be fixed.
Good luck to you.
Thanks a lot!
it worked for me with point 1.
Thank you very much....
To solve problems, me too...
- Thank you juicyjuice. You helped me to to not have a nervous breakdown. (-:
Great post, thanks!
In my case, I just had two closing "</FORM>" tags in my aspx page.
I agree with JustDave. The fix for the InitializeCulture error was making sure the Inherits="xyz" in each aspx was also then shown as the correct Partial Class xyz in the codebehind page; plus making sure all of these Partial Class names were unique throughout the application.
I just don't understand why (a) it works when running/testing in the Devlopment environment, and (b) why it does not show up in the Build errors. (VS 2005). Would have saved me a lot of time.
I ran into this after changing the compilation method by using Website Deployment and setting the output assemblies to merge each individual folder output to its own assembly!
I have a few pop up windows (like calendar) that I used to just copy and paste from one directory to another - the copy and paste didn't change the Partial Class so there were a few versions with the same class name - by editing these on both the aspx page and the page behind to the default Root_Directory_Directory_FileName and once again making the class unique it cured the problem...
Mendip162 wrote: Dear JuicyJuice,
Thanks for your post - until I read this I thought I was going crazy.
Step 5 was the last stage that fixed the problem for me too. Many thanks!
Este error se presenta porque existen dos o mas paginas que estan definidas asi:
<%
@ Page Language="VB" MasterPageFile="~/Principal.master" AutoEventWireup="false" CodeFile="FrmConsulta.aspx.vb" Inherits="FrmConsulta" title="xx" %>debe revizar que todas apuntes a codebehin asi:
Partial
Class FrmConsulta Inherits System.Web.UI.Pageend class
en mi caso encontre el error porque estaba Inherits="_default", de esta forma llamada frmconsulta lo normal es que apunte al mismo nombre pero estaba apuntando al _default y esta pagina ya existia. Default.aspx
Espero le sea de utilidad
JustDave wrote: For me it was due to the fact that I copied and pasted an APS.Net page with a codebehind page. When I renamed the APSX, it automatically renamed the aspx.vb file. The problem was that the partial class was duplicated. It worked in the runtime environment, but not once I published it to the Web server.
Once I changed the name of the partial class in the codebehind file, and the corresponding inherits statement in the aspx, It worked fine.
That's what did it for me
Hi
If you use Visual studio to publish your site, during the publishing stage on framework 2.0 uncheck the "allow this precompiled site to be updatable". (This tip was helpful in my context).
Thanks a lot
Nishant- I noticed 2 errors on our production server. The production server runs vbc version 8.0.50727.1433 and my desktop machine runs 8.0.50727.1434. I did not get either of these errors on my desktop machine.
The 1st problem which caused the InitializeCulture error was that the filenames were lower case and the classnames where Camel style e.g. file was called shopping.aspx instead of Shopping.aspx. So i changed it and it worked without a problem.
The 2nd problem was that i inherited a class using the full namespace value which the containing class also had. I got the error that it could not find this type. Below is an example that didn't work
Namespace Test.FurnitureCode SnippetPartial Class Chair
Inherits Test.Furniture.SeatingEnd ClassEnd Namespace
But the following did work
Namespace Test.FurnitureCode SnippetPartial Class ChairEnd Namespace
Inherits SeatingEnd Class - I use asp.net 3.5. I had an aspx file by the name of x.aspx and the corresponding codebehind file x.aspx.vb. Additionally I created a new linq2sql class file (y.dbml) that linked to a table called x. Saving the dbml file, automatically created a Partial Public Class x that "sometimes" BC30456-crashed with the Partial Class x in x.aspx.vb. I renamed x.aspx to z.aspx (and adapted the inherits statement and the codebehind file) and my life was worth living again :-)
buchholz@hs-bremen.de - Thanks!
Step one did it immediately! - Step one did it for me. Thanks for the help.
- Thanks
Step one solved!- Edited byFareeth Friday, August 22, 2008 7:52 PMNothing
- Step 1 worked for me.
Ben - I was helped by this post too, thanks juicyjuice!
- Thanks, removing ver1.1 files from bin folder worked for me.
Hey guys, thanks everyone for their contributions and making this one of the most popular posts on msdn. Good to see everyone now sorted on this bug which seems to still exist but alas less frequent with later versions of asp.net.
-JuicyJuice
Aka: Zarok
work in I.T in Wellington NZ.. props to the kiwi's out there :)
- Hi Everybody,
My situation is a bit different from all of the above. I encounter the same error while debugging. I applied all of the above mentioned solutions with no success at all.
I have a signin.aspx page for which I have a hyperlink <asp:hyperlink> in the page header. If the link is clicked then the error is generated. While if the same page is accessed from code, all is fine. Earlier the page was working fine but now the same page is issuing the error recursively.
If anyone knows any other solution please let me know.
Many thanks in advance for your cooperation.
- Proposed As Answer byHaricharan Maramraj Wednesday, April 15, 2009 12:10 AM
- Thank you juicyjuice. I had ambiguous inheritance and your post ended up saving me a ton of hair pulling.
I was going mad. Thank you thank you thank you! - Thanks !! If you use Visual studio to publish your site, during the publishing stage on framework 2.0 uncheck the "allow this precompiled site to be updatable" has solved my problem.It has been observed that "window.open" command using Java script does not function unless we do the above step while publishing.
I had the same situation as BCHAO above. I attempted to copy source code from an existing page into a newly created page to get a "jumpstart" instead of creating new page from scratch. When I rebuilt, the original page started failing, saying that my controls "...were not members..." Fortunately, I do all development on a development server so I could go back to my latest production and compare. Turns out that the new "FormName.aspx.designer.vb" -- where FormName is the page I copied the source code from -- file was messed up. it reflected the controls of the newly created form instead of it's original controls. I think it's because when I created the new form, I failed to update the codebehind and references line in the source code so the new form incorrectly referenced the original instead of the new. I corrected the problem by swiping the contents of "FormName.aspx.designer.vb" on the production site and replacing the "FormName.aspx.designer.vb" code on the dev side.
Retred Air Force

