Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i get the requested url in a webservice using asp.net?

I am writing a WebService and wants to find out the URL the client used to call my WebMethod.

Ok..i will explain it in detail..

Suppose i have a webservice (http://myWebservice/HashGenerator/HashValidator.asmx) as follows

[WebMethod]
public string ValidateCode(string sCode)
{
  //need to check requested url here.The call will be coming from different sites
  //For example www.abc.com/accesscode.aspx
}

please send me a solution for this.

like image 242
user455423 Avatar asked Nov 24 '10 08:11

user455423


1 Answers

You need this:

[WebMethod]
public static string mywebmethod()
{
string parameters =  HttpContext.Current.Request.UrlReferrer.PathAndQuery.ToString();
return parameters
}
like image 69
BioFrank Avatar answered Oct 14 '22 14:10

BioFrank