In my web service, how can I check the URL of the web site from where the web service call originated please? Thank you.
In your scenario I think you have a web application hosted in IIS and that web application is consuming asmx web services and you need to get the name of the page which called the service in the service implementation.
The ASMX webservices are not limited to access from the web sites. They can be accessed from the desktop applications as well which don't have webpage url. So in this context we expect to get the web page URL as is inside the web service implementation. You may get the IP address of the caller machine. But seems that is not enough.
So only way is to pass the name of the webpage from the calling code via parameter or http header.
I believe what you're asking is for the requesting URL of the Web service called.
webpage.aspx -- (calls ) --> MyWebService.asmx.
the referrer is webpage.aspx
Try using Context.Request.UrlReferrer from the webservice.
Related
Following is my problem scenario.
I have an ip address 1.2.3.4
My client will make a webrequest like : http://1.2.3.4/aaa&bbb&ccc
I need to capture this request and instead of serving a web page I want to do something with the "aaa&bbb&ccc" part.
This process will keep looping.
I know how to host a website or a web service on IIS. My confusion is, how do I receive the request on my IP and instead of serving a webpage, just eat it up and 'digest' it. I will have IIS 7 as the web server and ASP.Net/C# as my dev environment.
How do I do this? (Would using a RESTFull ASP web service be a good practice?)
Sincere thanks and regards.
Actually you are looking for Web Service, which grab a request from client(can be in static IP & method name), and do what ever developer wants with the entrance parameters(without have to serve a page).
you can read this for more informations Getting raw soap data from a web reference client running in asp.net
I have a asmx web service hosted at US as well as Canada. But there are few Canadian clients which points to US web service and I am not able to make any changes at client side to make them point to Canadian web service.
Is there any way I can redirect calls coming to US Web Service (Before web method hit) to Canadian web service? May be some HttpModule or SoapExtensions?
I ended up doing what I didn't want to.
I added proxy of own web service and called it by overwriting URL in each web method. I structured it by adding factory class.
Thanks!
How Passive adfs 2.0 authenitcation for Web application can consume WCF Restful Services?
I am using ASP.NET 4.0, C# to develop web application and WCF Rest Service.....
So could you please help me to understand how to secure Restful service using claim based authentication
Here is what I need: -
I have a Web App and WCF Rest service with webhttpbinding gets called from ajax jquery.
Now the user logs into the Web App which is relying party, he is redirected to the adfs login page.
Once logged in, he is redirected back to the Web app.
This web app invokes the wcf Service.
Passive authentication is working fine but issue is when calling WCF service.
In ajax call for wcf service get undefined error. (namespace attribute is not getting added example
var svc = project.services.AjaxService()
where project does not include services and namespace attribute is missing which is present when same code is getting called from form authentication.
Where project.services is namespace for service class AjaxService.
And also same service is getting called using Telerik controls WebServiceSettings.
Can anyone please help me in this. what configuration setting is required and anything else need to be added?
How can i achieve both using ajax and telerik.
How do I extract/get the URL name that is consuming my web service?
For say, i have a .asmx web service, consumed by .aspx web app, in my .asmx code, i need to get that web app's url? Is that any way doable?
You just need to inspect the HTTP request.
HttpContext.Current.Request.UrlReferrer
I have ASMX services for my web application that I would only like available to the same application.
Is there a way for the web service to only be accessible by the same application, such as relative/absolute path restrictions?
The easiest route would be to just not use a web service. If you're calling from the same application, you can probably just pull your logic into a separate class, and call it directly in your code, not via web service.
Two ways to do this:
Have the web services hosted on a different box. The main web box is on a publicly accessible IP (ie. in the DMZ), while the web service box is only accessible to the internal network.
You might be able to do this with sufficient networking gymnastics. For example, host the web services on the same box but a different IP, and have the firewall block any outside calls to that IP.
Web services can be called by all sorts of code, not just code that's part of a web site. So, in general, there is no "calling URL".