Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > BOOK: Beginning ASP.NET 1.0
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 2nd, 2004, 02:10 PM
Authorized User
 
Join Date: Jul 2004
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.


  #2 (permalink)  
Old August 2nd, 2004, 02:37 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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
  #3 (permalink)  
Old August 2nd, 2004, 02:54 PM
Authorized User
 
Join Date: Jul 2004
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.


  #4 (permalink)  
Old August 2nd, 2004, 03:16 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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
  #5 (permalink)  
Old August 2nd, 2004, 05:33 PM
Authorized User
 
Join Date: Jul 2004
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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



  #6 (permalink)  
Old August 3rd, 2004, 01:19 PM
Authorized User
 
Join Date: Jul 2004
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
  #7 (permalink)  
Old August 3rd, 2004, 02:04 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

You are using .NET framework 1.0, I wonder if upgrading to 1.1 would solve any of your problems???

Brian
  #8 (permalink)  
Old August 3rd, 2004, 02:14 PM
Authorized User
 
Join Date: Jul 2004
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

May be, let's try it!

I am downloading using "Windows Update".
Hope it will help.
  #9 (permalink)  
Old August 4th, 2004, 07:14 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Did that work?
  #10 (permalink)  
Old August 4th, 2004, 11:45 AM
Authorized User
 
Join Date: Jul 2004
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.



 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
simply query calculations!!!!!! thedom Access 0 March 13th, 2007 06:37 PM
Name a range simply for each third cell wapfu Excel VBA 2 December 6th, 2006 03:04 PM
Simply Deleting Question - ThnX ! ank2go SQL Language 2 November 16th, 2004 04:55 PM
How to access Simply Accounting fields from Access lguzman Access VBA 4 September 16th, 2004 02:55 PM
problem on example code zerocold C# 0 July 15th, 2004 04:19 PM



All times are GMT -4. The time now is 02:20 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.