473,602 Members | 2,846 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

code called from web page or webservice

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.Http Context.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 HttpSessionStat e. 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
Nov 19 '05 #1
1 1013
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" <no****@thank.y ou> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
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.Http Context.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 HttpSessionStat e. 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

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3433
by: Bruce W.1 | last post by:
The intent of my web service is an RSS feed from a blog. Originally I used a StringBuilder to make the XML and returned a string from the webmethod. But this doesn't display properly in IE. So now I'm trying an XmlTextWriter instead. I whipped-up another webservice based on this: http://www.codeproject.com/aspnet/RSSviaXmlTextWriter.asp?print=true This example isn't set up strictly as a webservice. It seems to output to an aspx...
12
4115
by: Jose Fernandez | last post by:
Hello. I'm building a web service and I get this error. NEWS.News.CoverNews(string)': not all code paths return a value This is the WebMethod public SqlDataReader CoverNews(string Sport) {
1
1102
by: C Williams | last post by:
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).
2
2202
by: Peter | last post by:
I have a Web page which calls a WebService, this web service call might take few seconds to up 30 min I was thinking of having a webpage query the webservice every minute to keep it form timing out, but I am not sure how to do that, somehow I have to have the webpage query the status of the Webservice request every minute or so to keep it from timing out. I was thinking to do the following: 1) Web page calls a webservice
0
7993
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8404
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5867
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1254
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.