Accessing Server Variables From Within Web Services 来源: 时间:2002-09-12 14:50 作者:AMTeam.org Accessing Server Variables From Within Web Services
Manohar Kamath Level: Beginner One of the most often asked question in newsgroups is "How do I get the IP address of the client browser within a web service?" The answer is very simple. The Context class within the system.web.services namespace represents the context of the web service. In other words, it has reference to various objects from within a running web service -- things like Response, Request and Session objects, and also such information as if the debugging is enabled on the service. In this article, we will take a look at a very basic example that describes two things Retrieve the IP address of the client browser <%@ Webservice Language="C#" class="httpvars"
%> public class httpvars :
WebService // This method returns the all the server variables as
HTML serverVars = Context.Request.ServerVariables; // Retrieve all the Keys from server variables
collection // Loop through the keys array and obtain
the |
关键词:
|
相关文章 |