Solved

500pts: Using Request.ServerVariables in Web service?

Posted on 2006-11-08
3
236 Views
Last Modified: 2012-05-05
Hi there,

Can anyone help, i can't seem to be able to use Request.ServerVariables in a webservice app i have written, i know its not exactly an asp.net app but it runs in a similar app..

Am i missing something?

Thanks in advance

Ian
0
Comment
Question by:ianinspain
  • 2
3 Comments
 
LVL 15

Expert Comment

by:ozymandias
ID: 17897212
[WebMethod]
public string HelloWorld()
{
      return "Hello World from " + HttpContext.Current.Request.ServerVariables["SERVER_NAME"];
}
0
 
LVL 15

Accepted Solution

by:
ozymandias earned 500 total points
ID: 17897215
WebServices don't automatically have an HttpContext like and asp.net page does so you have to get one manually.
0
 

Author Comment

by:ianinspain
ID: 17899092
Cool thanks..!!

Ian
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question