• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 251
  • Last Modified:

500pts: Using Request.ServerVariables in Web service?

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
ianinspain
Asked:
ianinspain
  • 2
1 Solution
 
ozymandiasCommented:
[WebMethod]
public string HelloWorld()
{
      return "Hello World from " + HttpContext.Current.Request.ServerVariables["SERVER_NAME"];
}
0
 
ozymandiasCommented:
WebServices don't automatically have an HttpContext like and asp.net page does so you have to get one manually.
0
 
ianinspainAuthor Commented:
Cool thanks..!!

Ian
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now