Reference in .aspx file causes server error

W

Waldy

Hi there,
I have a Web Application that uses a reference to a localhost
web service. If however, I try to insert C# code blocks into the .aspx file
I get an error when the application runs because localhost is unknown.
Anyone know how to use a reference in a code block?
 
G

Geek

Hi there,
             I have a Web Application that uses a reference to a localhost
web service.  If however, I try to insert C# code blocks into the .aspx file
I get an error when the application runs because localhost is unknown.
Anyone know how to use a reference in a code block?

did u check the webservice first? .
 
W

Waldy

did u check the webservice first? .

Yes, the web service is fine. It works in the code behind file, but not in
a code block. Is this a known limitation of ASP.Net?
 
W

Waldy

I noticed that the Web Service reference does not colour the class name in
the code block like it does in the code behind file. I appears as though
the code blocks are not in the project namespace. If I add the namespace to
the reference like so,

MyNameSpace.localhost.TheWebService

the class name part becomes coloured, but it now crashes with a different
error:

Cannot create/shadow copy 'LogCall' when that file already exists
 
W

Waldy

The cannot create/shadow copy ... error message was a red herring. It went
away after I did a Clean and Rebuild.
So to sum up, if you need to access a web service in an .aspx code block,
you need to qualify the webservice name with the namespace name where the
reference has been added.
 

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,171
Messages
2,570,936
Members
47,472
Latest member
KarissaBor

Latest Threads

Top