Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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
 
Old December 21st, 2005, 02:54 AM
Registered User
 
Join Date: Dec 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default More than one class !

Hi all !

Is it possible to have more than one class in the .asmx file which represents the web service.

consider this example

Here the file name is Service1.asmx which has the two classes
Service1 and Service2

namespace CSharpWebService
{
public class Service1 : System.Web.Services.WebService
{
}
public class Service2 : System.Web.Services.WebService
{
}

}

Is it not possible to access Service2 even though they are in the same .asmx file



Nesting like this also doesnt help
namespace CSharpWebService
{
public class Service1 : System.Web.Services.WebService
{
public class Service2 : System.Web.Services.WebService
{
}
}

}


Kindly sugest a solution
Thanks in advance
 
Old December 22nd, 2005, 12:56 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You can place any number of classes in a single file as long as it compiles OK. However, remember that when you build a page, control or web service each can only be derived from a single class.

If you place several classes in a single file when they are compiled (either manually by you or automatically by the ASP.NET worker process) all the classes are accessible and usable by the code in them. In other words, if you build a utility class in the same file as an ASPX code-behind class, the code-behind class can access that utility class.

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using logging class as a static class punitw General .NET 0 August 14th, 2008 03:03 AM
Property access from Class within Partial Class zoltac007 C# 2005 0 December 1st, 2006 01:01 AM
Regarding Class Library (.dll) from class file manish.sharma04 BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 March 3rd, 2006 07:32 AM
Class disappears in the class panel hint2310 Visual C++ 0 September 18th, 2004 03:46 PM
How to include c# class and vb class in the .vbprj umeshayk VS.NET 2002/2003 2 January 9th, 2004 12:08 AM





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