Reference in .aspx file causes server error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Waldy

    Reference in .aspx file causes server error

    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?


  • Geek

    #2
    Re: Reference in .aspx file causes server error

    On Jun 4, 4:44 pm, "Waldy" <some...@micros oft.comwrote:
    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? .

    Comment

    • Waldy

      #3
      Re: Reference in .aspx file causes server error


      "Geek" <kannan.surf@gm ail.comwrote in message
      news:413c8180-40e2-44a5-a168-5ca1189fffbb@z1 6g2000prn.googl egroups.com...
      On Jun 4, 4:44 pm, "Waldy" <some...@micros oft.comwrote:
      >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?




      Comment

      • Waldy

        #4
        Re: Reference in .aspx file causes server error

        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.loc alhost.TheWebSe rvice

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

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


        Comment

        • Waldy

          #5
          Re: Reference in .aspx file causes server error

          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.


          Comment

          Working...