Newbie - Directive causes syntax error

J

John Kotuby

I am studying a Wrox book, "Beginning ASP.NET 1.1 with VB.NET".

In the chapter on Web Services I am trying an example in VS 2003 with VB.NET
that shows what they are calling a Processor Directive that should be at the
top of the code page (according to the book) before the Imports statements.
Note that the book is using WebMatrix as the development tool and I am using
VS.NET.

Here is partial example code in the book:

<%@ WebService language="VB" class="MeasureConvert" %>
Imports System.Web.Services
Imports System.XML.Serialization

VS is pointing out 2 errors.

"Imports statements must preceed any declarations"
The % is underlined with the error text "Character is not valid"

When I move the "Directive" below the Imports statements, the first error
goes away, but the "Character is not valid" remains.

Now, when I leave out the...
<%@ WebService language="VB" class="MeasureConvert" %>
.... entirely, the Web Service runs just fine. Does anyone know what the
problem might be?

Thanks in advance...
 
M

Mujtaba Syed

My guess: The code given in the book uses just an ASMX file but you are
using ASMX and its code-behind ASMX.VB and you have put the WebService
directive in the code-behind.
When using VS.NET, the ASMX file is created for you with the WebService
directive. You just need to implement the class which goes behind the ASMX.
Your book should have details on this.

Mujtaba
 
J

John Kotuby

Thanks Mujtaba

That was it

Have a good day

Mujtaba Syed said:
My guess: The code given in the book uses just an ASMX file but you are
using ASMX and its code-behind ASMX.VB and you have put the WebService
directive in the code-behind.
When using VS.NET, the ASMX file is created for you with the WebService
directive. You just need to implement the class which goes behind the
ASMX.
Your book should have details on this.

Mujtaba
 

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

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top