code called from web page or webservice

Discussion in 'ASP .Net' started by C Williams, Oct 19, 2005.

  1. C Williams

    C Williams Guest

    Hi,

    I have a small piece of code that is used by both a web page and by a
    web service. I'd like some different behaviour depending on whether it
    is called by the page or by the service.

    In the piece of code, I can determine the calling source (page/service)
    by checking to see if System.Web.HttpContext.Current.Session is null
    (which it will be for service and won't be for page).

    The thing is--I would like for the piece of code to be able to look up a
    bit of information at this point. For the page, that bit of information
    is stored in the HttpSessionState. How can I store this information so
    that when the code is called from the web service it can be looked up?

    In this case, unfortunately, passing parameters directly isn't a good
    option for me.

    Thanks for any help you can give.

    -Casey
    C Williams, Oct 19, 2005
    #1
    1. Advertising

  2. Casey,

    If you can't pass it to the page then I think storing it in a database
    before calling the code and then having the code retrieve it from the
    database would be your best option.

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
    "C Williams" <> wrote in message
    news:%23nhr$...
    > Hi,
    >
    > I have a small piece of code that is used by both a web page and by a web
    > service. I'd like some different behaviour depending on whether it is
    > called by the page or by the service.
    >
    > In the piece of code, I can determine the calling source (page/service) by
    > checking to see if System.Web.HttpContext.Current.Session is null (which
    > it will be for service and won't be for page).
    >
    > The thing is--I would like for the piece of code to be able to look up a
    > bit of information at this point. For the page, that bit of information
    > is stored in the HttpSessionState. How can I store this information so
    > that when the code is called from the web service it can be looked up?
    >
    > In this case, unfortunately, passing parameters directly isn't a good
    > option for me.
    >
    > Thanks for any help you can give.
    >
    > -Casey
    S. Justin Gengo, Oct 19, 2005
    #2
    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. Apricot
    Replies:
    4
    Views:
    516
    velthuijsen
    Apr 16, 2004
  2. Weng Tianxiang
    Replies:
    6
    Views:
    585
    glen herrmannsfeldt
    Sep 12, 2007
  3. S_K
    Replies:
    6
    Views:
    1,168
    Robert Dunlop
    Nov 8, 2007
  4. Felix
    Replies:
    1
    Views:
    330
    Felix
    Sep 29, 2006
  5. Replies:
    2
    Views:
    125
Loading...

Share This Page