Classes undefined

T

tshad

I actually have 2 questions:

1) I am getting an error "Type 'TempClass1' is not defined"

Why?

Here is my DLL, where I have 3 classes defined outside of my Web Class:
AuthHeader, ServiceTicket and TempClass1
**************************************************************************
<%@ WebService Class="SecureService" debug="True"%>

Imports System
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data
Imports System.Data.SqlClient

<WebService( Namespace:="http://10.0.0.25/webservices" )> _
Public Class SecureService : Inherits WebService

Public AuthenticationHeader As AuthHeader

<WebMethod()> Public Function Login( username As String, password As
String ) As ServiceTicket

End Function

End Class

Public Class AuthHeader:Inherits SoapHeader
Public SessionKey As String
End Class

Public Class ServiceTicket:Inherits AuthHeader
Public IsAuthenticated As Boolean
Public SessionKey As String
Public Expiration As DateTime
End Class

Public Class TempClass1:Inherits ServiceTicket
Public TomsClass1Name As String
End Class
************************************************************************

My Web page is :
*********************************************************************
<%@ Import Namespace="Services" %>

<Script runat="Server">

Sub Page_Load
Dim objSecureService As SecureService
Dim objServiceTicket As ServiceTicket
Dim objAuthHeader As AuthHeader
Dim objTempClass1 As TempClass1

objSecureService = New SecureService
objServiceTicket = Session( "ServiceTicket" )
objTempClass1 = new TempClass1

</Script>

<html>
<head><title>TestSecureService.aspx</title></head>
<body>

<asp:Label
id="lblLuckyNumber"
EnableViewState="False"
Runat="Server" />

</body>
</html>
**********************************************************************

Why do I only get an error on TempClass1 and not on the others?

It turns out I can modify the Login function to all three class without any
problem, like:
*******************************************************************
<WebMethod()> Public Function Login( username As String, password As
String ) As ServiceTicket
Dim objServiceTicket As new ServiceTicket
Dim objAuthHeader As new AuthHeader
Dim objTempClass1 As new TempClass1

End Function
******************************************************************

So I can call all these classes, which makes sense as they are all in the
same file.

But why can I use ServiceTicket and AuthHeader, but not TempClass1??????

They are defined the same way. They are in the same file.


2) In my Web page I have:

<%@ Import Namespace="Services" %>

But I don't have Namespace Services. Is this an MS Namespace?

Thanks,

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,007
Messages
2,570,266
Members
46,864
Latest member
DaniEbswor

Latest Threads

Top