 |
BOOK: Beginning ASP.NET 1.0  | This is the forum to discuss the Wrox book Beginning ASP.NET 1.0 with C# by Chris Goode, John Kauffman, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Dave Sussman, Ollie Cornes, Rob Birdwell, Matt Butler, Gary Johnson, Ajoy Krishnamoorthy, Juan T. Llibre, Chris Ullman; ISBN: 9780764543708 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 1.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

August 2nd, 2004, 02:10 PM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Problem with a very simply code:
First, this is my very simple code:
The CodeBehind file called "class1.cs":
========================================
using System;
using System.Data;
using System.Data.OleDb;
using System.Web.UI;
using System.Web.UI.WebControls;
public class Doit : Page
{
public Label data_src;
public void Page_Load()
{
Response.Write("This is the function page load");
data_src.Text="This is the Text in my lavel";
}
}
This is the ASPX file called "WebForm1.aspx":
==============================================
<%@ Page language="c#" Src="Class1.cs" CodeBehind="Class1.cs" Inherits="Doit" ResponseEncoding="windows-1255" %>
<HTML>
<body>
<h4>Testing the data connection -->
<asp:label id="data_src" runat="server" /></h4>
</body>
</HTML>
Now, while trying to see it I am getting this Error message:
================================================== ==========
Compilation Error
Description:
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.
Compiler Error Message: CS1595: 'Doit' is defined in multiple places; using definition from 'C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\Temp orary ASP.NET Files\webapplication10\fecc437c\e2276287\lgdsvmmd. dll'
Source Error:
Line 27:
Line 28: [System.Runtime.CompilerServices.CompilerGlobalScop eAttribute()]
Line 29: public class WebForm1_aspx : Doit, System.Web.SessionState.IRequiresSessionState {
Line 30:
Line 31: private static int __autoHandlers;
Source File:
C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\Tempo rary ASP.NET Files\webapplication10\fecc437c\e2276287\bt5_cqpv. 0.cs Line: 29
***
I don't know what it means becouse I don't see any problem with my code.
|
|

August 2nd, 2004, 02:37 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
It means you have Doit defined in several places; you have the Doit class defined at the same scope for multiple pages classes, etc. You need to make sure they are in different namespaces.
Brian
|
|

August 2nd, 2004, 02:54 PM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
For now, I don't know what it means namespace. I have only one application with only the two files I wrote avobe plus others files the Visual Studio made by itself.
The Solution Explorer root look like this:
==========================================
+ WebApplication
- References
- AssemblyInfo.cs
- Class1.cs
- Global.asax
- Web.config
- WebApplication1.vsdisco
- WebForm1.aspx
Theis are all my files in this project. What did I miss?
I can change the DOIT name to another name but still I am getting the same message. It doesn't matter what the name off the function will be, I am getting the ERROR anyway.
|
|

August 2nd, 2004, 03:16 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Wrap this around the page as shown below (replace MyAppName with name of app):
namespace MyAppName {
public class Doit : Page
{
public Label data_src;
public void Page_Load()
{
Response.Write("This is the function page load");
data_src.Text="This is the Text in my lavel";
}
}
}
Change:
<%@ Page language="c#" Src="Class1.cs" CodeBehind="Class1.cs" Inherits="Doit" ResponseEncoding="windows-1255" %>
to (change MyAppName to your application name)
<%@ Page language="c#" Src="Class1.cs" CodeBehind="Class1.cs" Inherits="MyAppName.Doit" ResponseEncoding="windows-1255" %>
Then try that.
Brian
|
|

August 2nd, 2004, 05:33 PM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi, I did it but still getting the same ERROR message:
================================================== =======
Compilation Error
Description: 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.
Compiler Error Message:
CS1595: 'MyName.Doit' is defined in multiple places; using definition from 'C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\Temp orary ASP.NET Files\webapplication10\fecc437c\e2276287\assembly\ dl2\6a2ba62c\003f5c48_e778c401\WebApplication10.DL L'
Source Error:
Line 27:
Line 28: [System.Runtime.CompilerServices.CompilerGlobalScop eAttribute()]
Line 29: public class WebForm1_aspx : MyName.Doit, System.Web.SessionState.IRequiresSessionState {
Line 30:
Line 31: private static int __autoHandlers;
Source File:
C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\Tempo rary ASP.NET Files\webapplication10\fecc437c\e2276287\6_giixdd. 0.cs Line: 29
|
|

August 3rd, 2004, 01:19 PM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
OK.
Now I don't get any ERROR but my function don't do anything.
I solve the problem by DELETE the "src=_____" from the @Page directive in my ASPX file. Could it be that my VS.NET can't see both Src and CodeBehind at the page directive?
This is strange. I get the ERROR only when I use the src also in my page directive.
What can be the problem that my Page_load function don't being called at all?
I haven't change anything at the CS file.
|
|

August 3rd, 2004, 02:04 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Hey,
You are using .NET framework 1.0, I wonder if upgrading to 1.1 would solve any of your problems???
Brian
|
|

August 3rd, 2004, 02:14 PM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
May be, let's try it!
I am downloading using "Windows Update".
Hope it will help.
|
|

August 4th, 2004, 07:14 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Did that work?
|
|

August 4th, 2004, 11:45 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
No, I don't know what the problem with my "Doit" function.
The Page_load doesn't do anything as written in the code.
The Output is only:
Testing the data connection -->
The "data_src" Label and the "Response.Write" don't do anything.
I think the function doesn't being called at all.
|
|
 |