S
Steve Richter
I have a simple project that builds ok in Visual Web Developer, but
which fails when I navigate to it at //localhost. The error is
"namespace 'ac' could not be found".
the problem page is at
inetpub/wwwroot/DemoSite/Page1.aspx
which I navigate to at
//localhost/DemoSite/Page1.aspx
I manually created a /bin directory within the /DemoSite directory:
c:/inetpub/wwwroot/DemoSite/bin
So DemoSite is my application root directory and /bin is my ~/bin
directory? Is that correct?
I built a class library "ac" using the C# compiler and copied ac.dll to
the ~/bin directory.
Visual Web Developer liked this arrangement because I was able to
successfully build a single page web site that referenced a static
method in the "ac" namespace.
c://inetpub/wwwroot/DemoSite/Page1.aspx
However, when I navigate to my website page at
//localhost/DemoSite/Page1.aspx
two odd things happen:
- IIS compiles the page again. But I had built the website thru
Visual Web Developer. Why is IIS compiling it again?
- the IIS build fails because namespace "ac" is not found. Why does
the IIS build not find the namespace in /DemoSite/Bin/ac.dll just like
VWD2005 does?
Source code and error messages follow.
-Steve
<%@ Page Language="C#" Trace=true %>
<%@ Import Namespace="ac" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
void Page_Load(object sender, EventArgs e)
{
Trace.Write("AutoCoder", ac.Common.GetConnectionString());
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
-------------------------------------------------------------
Compiler Error Message: CS0246: The type or namespace name 'ac' could
not be found (are you missing a using directive or an assembly
reference?)
Source Error:
Line 1: <%@ Page Language="C#" Trace=true %>
Line 2: <%@ Import Namespace="ac" %>
Line 3:
Line 4: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
Source File: c:\Inetpub\wwwroot\DemoSite\Page1.aspx Line: 2
which fails when I navigate to it at //localhost. The error is
"namespace 'ac' could not be found".
the problem page is at
inetpub/wwwroot/DemoSite/Page1.aspx
which I navigate to at
//localhost/DemoSite/Page1.aspx
I manually created a /bin directory within the /DemoSite directory:
c:/inetpub/wwwroot/DemoSite/bin
So DemoSite is my application root directory and /bin is my ~/bin
directory? Is that correct?
I built a class library "ac" using the C# compiler and copied ac.dll to
the ~/bin directory.
Visual Web Developer liked this arrangement because I was able to
successfully build a single page web site that referenced a static
method in the "ac" namespace.
c://inetpub/wwwroot/DemoSite/Page1.aspx
However, when I navigate to my website page at
//localhost/DemoSite/Page1.aspx
two odd things happen:
- IIS compiles the page again. But I had built the website thru
Visual Web Developer. Why is IIS compiling it again?
- the IIS build fails because namespace "ac" is not found. Why does
the IIS build not find the namespace in /DemoSite/Bin/ac.dll just like
VWD2005 does?
Source code and error messages follow.
-Steve
<%@ Page Language="C#" Trace=true %>
<%@ Import Namespace="ac" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
void Page_Load(object sender, EventArgs e)
{
Trace.Write("AutoCoder", ac.Common.GetConnectionString());
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
-------------------------------------------------------------
Compiler Error Message: CS0246: The type or namespace name 'ac' could
not be found (are you missing a using directive or an assembly
reference?)
Source Error:
Line 1: <%@ Page Language="C#" Trace=true %>
Line 2: <%@ Import Namespace="ac" %>
Line 3:
Line 4: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
Source File: c:\Inetpub\wwwroot\DemoSite\Page1.aspx Line: 2