{"id":803,"date":"2006-01-31T23:10:00","date_gmt":"2006-01-31T23:10:00","guid":{"rendered":"http:\/\/mooredynasty.net\/?p=803"},"modified":"2014-12-18T23:10:45","modified_gmt":"2014-12-18T23:10:45","slug":"asp-net-2-0-namespace-issues","status":"publish","type":"post","link":"https:\/\/mooredynasty.net\/index.php\/2006\/01\/asp-net-2-0-namespace-issues\/","title":{"rendered":"ASP.NET 2.0 Namespace Issues"},"content":{"rendered":"<p>A nifty feature of ASP.NET 2.0 is the ability to store all of your application&#8217;s code in the App_Code folder and automatically have it be compiled into one big, happy namespace.&#160; Most of the time this works well; however, when you&#8217;re doing a forms authentication-based application and are:&#160; A) too lazy to deal with Membership; or B) bound to another way of doing things, this can bite you.   <br \/>What is the natural name you&#8217;d give to a page used to log in to an application?&#160; Login.aspx, right?    <br \/>Unfortunately you cannot use this name because the Login class name is already consumed in the default namespace.&#160; Even more unfortunately this will work wonderfully until you compile and publish your application.&#160; At that point you will receive this error:<\/p>\n<h3>Server Error in &#8216;\/YourApp&#8217; Application.   <\/p>\n<hr size=\"1\" width=\"100%\" \/><\/h3>\n<h4><em>Compilation Error<\/em><\/h4>\n<p> <strong>Description: <\/strong>An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.   <br \/><strong>Compiler Error Message: <\/strong>CS0030: Cannot convert type &#8216;ASP.login_aspx&#8217; to &#8216;System.Web.UI.WebControls.Login&#8217;  <br \/><strong>Source Error:<\/strong>  <\/p>\n<p><code><\/code><\/p>\n<pre>Line 112:        public login_aspx() {<br \/>Line 113:            string[] dependencies;<br \/>Line 114:            ((Login)(this)).AppRelativeVirtualPath = &quot;~\/Login.aspx&quot;;<br \/>Line 115:            if ((global::ASP.login_aspx.@__initialized == false)) {<br \/>Line 116:                dependencies = new string[1];<\/pre>\n<p>Correcting this problem is not difficult &#8211; simply rename your .aspx file and change the code-behind class&#8217;s name.<br \/>\n  <br \/>Deducing that this is the underlying problem, however, can be a real pain!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A nifty feature of ASP.NET 2.0 is the ability to store all of your application&#8217;s code in the App_Code folder and automatically have it be compiled into one big, happy namespace.&#160; Most of the time this works well; however, when you&#8217;re doing a forms authentication-based application and are:&#160; A) too &hellip; <\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-803","post","type-post","status-publish","format-standard","hentry","category-development"],"_links":{"self":[{"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/posts\/803","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/comments?post=803"}],"version-history":[{"count":1,"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/posts\/803\/revisions"}],"predecessor-version":[{"id":804,"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/posts\/803\/revisions\/804"}],"wp:attachment":[{"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/media?parent=803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/categories?post=803"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/tags?post=803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}