WebService fails inside ASP 2.0 website

Discussion in 'ASP .Net' started by =?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?=, Jul 13, 2007.

  1. In my ASP.Net 2.0 website I defined base page type in web config as follows:
    <pages MaintainScrollPositionOnPostback="true" pageBaseType="base_Page" />
    It all works fine for the pages.

    Now I am adding webservices to the site - I use the same business objects
    and authentication/authorization.

    The code behind the webservice is trivial:

    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class MyService : System.Web.Services.WebService
    {}

    The problem is that when webservice is initiated, the compiler is trying to
    inherit my webservice from base_Page class - and obviously fails with the
    following error:
    "The MaintainScrollPositionOnPostback page directive cannot be set without
    an htmlform."

    The whole website compiles without any errors - I only receive this error
    when I attempt to call the service...

    How can I prevent my asmx webservice to attempt inheriting from base_Page
    which inherits from System.Web.UI.Page - as I specifically defined my
    webservice type????

    Any help is greatly appreciated.
    =?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?=, Jul 13, 2007
    #1
    1. Advertising

  2. =?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?=

    Teemu Keiski Guest

    Hi,

    issue occurs when you try to open the asmx in web browser since it is the
    test page which asp.net runs behind the scenes, it does not have server-side
    form only but when you use HTTP POST with the test form

    You'll find the file which is run by ASP.NET by looking at
    DefaultWsdlHelpGenerator.aspx on
    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG

    Simple way to get past this is to set MaintainScrollPositionOnPostBack on
    page directives directly.

    --
    Teemu Keiski
    AspInsider, ASP.NET MVP
    http://blogs.aspadvice.com/joteke
    http://teemukeiski.net


    "Sergey Poberezovskiy" <> wrote
    in message news:...
    > In my ASP.Net 2.0 website I defined base page type in web config as
    > follows:
    > <pages MaintainScrollPositionOnPostback="true" pageBaseType="base_Page" />
    > It all works fine for the pages.
    >
    > Now I am adding webservices to the site - I use the same business objects
    > and authentication/authorization.
    >
    > The code behind the webservice is trivial:
    >
    > [WebService(Namespace = "http://tempuri.org/")]
    > [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    > public class MyService : System.Web.Services.WebService
    > {}
    >
    > The problem is that when webservice is initiated, the compiler is trying
    > to
    > inherit my webservice from base_Page class - and obviously fails with the
    > following error:
    > "The MaintainScrollPositionOnPostback page directive cannot be set without
    > an htmlform."
    >
    > The whole website compiles without any errors - I only receive this error
    > when I attempt to call the service...
    >
    > How can I prevent my asmx webservice to attempt inheriting from base_Page
    > which inherits from System.Web.UI.Page - as I specifically defined my
    > webservice type????
    >
    > Any help is greatly appreciated.
    Teemu Keiski, Jul 13, 2007
    #2
    1. Advertising

  3. Thank you Teemu - it was it - it also occurs when I try to (web) reference
    the service from another project.
    As per your other post, I had to remove page-specific code from the site
    web.config - and them I could reference the service.

    "Teemu Keiski" wrote:

    > Hi,
    >
    > issue occurs when you try to open the asmx in web browser since it is the
    > test page which asp.net runs behind the scenes, it does not have server-side
    > form only but when you use HTTP POST with the test form
    >
    > You'll find the file which is run by ASP.NET by looking at
    > DefaultWsdlHelpGenerator.aspx on
    > C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG
    >
    > Simple way to get past this is to set MaintainScrollPositionOnPostBack on
    > page directives directly.
    >
    > --
    > Teemu Keiski
    > AspInsider, ASP.NET MVP
    > http://blogs.aspadvice.com/joteke
    > http://teemukeiski.net
    >
    >
    > "Sergey Poberezovskiy" <> wrote
    > in message news:...
    > > In my ASP.Net 2.0 website I defined base page type in web config as
    > > follows:
    > > <pages MaintainScrollPositionOnPostback="true" pageBaseType="base_Page" />
    > > It all works fine for the pages.
    > >
    > > Now I am adding webservices to the site - I use the same business objects
    > > and authentication/authorization.
    > >
    > > The code behind the webservice is trivial:
    > >
    > > [WebService(Namespace = "http://tempuri.org/")]
    > > [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    > > public class MyService : System.Web.Services.WebService
    > > {}
    > >
    > > The problem is that when webservice is initiated, the compiler is trying
    > > to
    > > inherit my webservice from base_Page class - and obviously fails with the
    > > following error:
    > > "The MaintainScrollPositionOnPostback page directive cannot be set without
    > > an htmlform."
    > >
    > > The whole website compiles without any errors - I only receive this error
    > > when I attempt to call the service...
    > >
    > > How can I prevent my asmx webservice to attempt inheriting from base_Page
    > > which inherits from System.Web.UI.Page - as I specifically defined my
    > > webservice type????
    > >
    > > Any help is greatly appreciated.

    >
    >
    >
    =?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?=, Jul 16, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Saunders
    Replies:
    1
    Views:
    657
    John Saunders
    Nov 18, 2003
  2. sck10
    Replies:
    1
    Views:
    410
    Michael Kolias
    Apr 13, 2006
  3. Qun Wang
    Replies:
    0
    Views:
    368
    Qun Wang
    Apr 21, 2006
  4. Replies:
    2
    Views:
    282
    Grant Wagner
    Dec 23, 2004
  5. dayo
    Replies:
    11
    Views:
    329
    Ilya Zakharevich
    Dec 16, 2005
Loading...

Share This Page