We are doing single sign on which is the web service project. We are getting User name, Domain, Password from client side and web service is working good. Now we would like to get Client URL in Web service. As we have implemented SSO in all projects
we are unable to ask clients to send Client URL. I need to get Client URL in Web service. We can get server IP where client application is Deployed. But we could not get Client URL in web service. Is there any chance to get Client URL in web service.
If you want to get the URL of the ASPX page calling the web service then you can pass the URL as argument to your web method or some custom HTTP header, for example:
using (testlocalhost.WebService1 ws = new testlocalhost.WebService1())
{
string currentUrl = HttpContext.Current.Request.Url.ToString();
testlocalhost.EmployeeName employee = ws.getEmployee_Information("first argument val", currentUrl);
}
and your web service method now looks like this:
[WebMethod]
public EmployeeName getEmployee_Information(string firstArg, string callerUrl)
{
//Get the caller URL
}
ramadurai ja...
Member
17 Points
113 Posts
Get Client URL in web service
Feb 07, 2012 01:41 PM|LINK
HI All,
We are doing single sign on which is the web service project. We are getting User name, Domain, Password from client side and web service is working good. Now we would like to get Client URL in Web service. As we have implemented SSO in all projects we are unable to ask clients to send Client URL. I need to get Client URL in Web service. We can get server IP where client application is Deployed. But we could not get Client URL in web service. Is there any chance to get Client URL in web service.
Note
I tried using below mentioned comments
1)
System.Web.HttpContext.Current.Request.Url.ToString();
We can get Web service URL using above comment..
2)
string UrlReferrer = HttpContext.Current.Request.UrlReferrer.ToString(); rent.Request.UrlReferrer.AbsoluteUri;
string UrlReferrer = HttpContext.Cur
When using above mentioned 2 comments it throws the below error.
System.Web.Services.Protocols.SoapException: Server was unable to process request.
---> System.NullReferenceException: Object reference not set to an instance of an object.
at SSO_LOG.SSO.AuthenticateUserCredential_Details(String UserName, String Password,
String Domain) in C:\Inetpub\wwwroot\SSO_LOG\SSO.asmx.cs:line 309
--- End of inner exception stack trace -We would like to get Client URL…We need urgent help.
Thanks and Regards
Ramadurai Jayaraman
Peter pi - M...
Star
12871 Points
1786 Posts
Re: Get Client URL in web service
Feb 14, 2012 12:28 AM|LINK
Hi,
If you want to get the URL of the ASPX page calling the web service then you can pass the URL as argument to your web method or some custom HTTP header, for example:
using (testlocalhost.WebService1 ws = new testlocalhost.WebService1()) { string currentUrl = HttpContext.Current.Request.Url.ToString(); testlocalhost.EmployeeName employee = ws.getEmployee_Information("first argument val", currentUrl); }and your web service method now looks like this:
[WebMethod] public EmployeeName getEmployee_Information(string firstArg, string callerUrl) { //Get the caller URL }Hope this helps
Regards,
Peter
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework