Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 14, 2012 12:28 AM by Peter pi - MSFT
Feb 07, 2012 01:41 PM|LINK
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.
I tried using below mentioned comments
We can get Web service URL using above comment..
string UrlReferrer = HttpContext.Current.Request.UrlReferrer.ToString();
string UrlReferrer = HttpContext.Current.Request.UrlReferrer.AbsoluteUri;
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
Feb 14, 2012 12:28 AM|LINK
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:
public EmployeeName getEmployee_Information(string firstArg, string callerUrl)
//Get the caller URL
Hope this helps