Upload A file to a ASP.NET WebService - asp.net

To send a File in AJAX request i used the way mentioned here . How do i write the WebMethod to accept the file?

The post & link provided gives a number of key points, please find them below:
The action being done is a post
The format of the object being sent is json
As your tag's are .net & web-services, you are interested in a solution on Microsoft Stack.
You use the term WebMethod, so you do not want to do this transaction via web api or WCF
See link for details for "Send and Receive JSON objects to Web Service Methods using jQuery AJAX in ASP.Net"

Related

Call ASP page via Web API

I'm working on a legacy ASP classic application. This application also supports an API, written in C# using Web API 2.
I'd like to add functionality to this API that will consume a request (as a resource - which will contain data need to satisfy a workflow), validate that request, and inside the API controller, generate a new request to an ASP page (the workflow is quiet complicated, so rather than re-write that logic, re-using the ASP page provides better business value).
Ideally I'd like to wait for the response inside the controller, and then pass back an Action Result (like a 204) to the consumer of the API.
The idea here is to hide the response of the ASP page, and return something simple to the consumer.
I know how to structure the URL somepage.asp?p1=help&p2=me, however I'm not sure how to create it as a request, execute it, and then consume the response within the API controller.
Is it even possible?

How to receive and process post data from a thirdparty company

I am using a thirdparty credicard processing company. I am sending amount to pay creditcard number etc to them. They said they will postback the results such as confirmation number to a url provided by me. I have to save the confirmation number in my database. Mine is an asp.net web application. I am wondering what will be best way to provide a url. Should I give an aspx page or create a http handler which will process the data from the third party company?
Thanks
Definitely a generic http handler (.ashx), because it's a lot more lightweight than .aspx.
The basic idea: use .ashx when you don't need to display a web page to end user, otherwise use .aspx.
Should I give an aspx page or create a http handler ... ?
Neither, use a WCF service.
WCF service to accept a post encoded multipart/form-data

eSendex SMS API

i'm trying to setup a script using classic .asp/vbscript to send an SMS using the eSendex "HTTP Form Post" service.
So far the script is working... here's what it does
Takes the form field values for the calling page
Sends an email
Saves the values into my database
The final thing that I want the script to do is send an SMS by communicating with the eSendex "HTTP Form Post" service, but their API documentation is not very helpful. An example script would have been nice!
If anyone has any experience with eSendex, maybe you could advises me!
Thanks in advance
There are two approaches you can take to communicate with the Esendex Form Post API from ASP.
You can either form an HTTP POST Request yourself and try POSTing the data directly to it, or you could use the EsendexSdk2.dll they provide as part of the ASP SMS SDK: http://www.esendex.co.uk/Developers/Downloads/ASP-SMS-SDK-Download
You can see examples of how to use the EsendexSdk2.dll with ASP here: http://www.esendex.co.uk/Developers/SDKs/ASP-SMS-SDK
In that zip download you'll find a SendMessage.asp example which takes values from fields on a form and calls SendMessage on the SendService.
The alternative HTTP POST Request approach would require you to do something like this SO question: Form post asp classic xmlhttp or this Microsoft support article: http://support.microsoft.com/kb/290591 using ServerXMLHttp from MSXML but I've not tried that method myself so it's just an alternative suggestion to using the DLL.
Your form data that you'd 'Send' in the ServerXMLHttp case would be a form encoded list of the variables like
username=YOURUSERNAME&password=YOURPASSWORD&account=EX000000&recipient=44770000000&body=hello
Feel free to give further examples of how you want to call the Esendex API from your code if it'll help and you can get excellent support from Esendex by emailing support#esendex.com.

http post from firefox extension to ASP.NET

I want to be able to send a simple http post from my firefox extension to my ASP.NET application. From the client side, I have used XMLHTTPRequest by sending the post with the url: http://localhost:15227 which is the url on my ASP.NET app.
What do I need to do to receive a remote request from ASP.NET please?
thanks
This page from Apple has a pretty good example of how to send/receive data using a raw XmlHttpReqeust object (as opposed to a JavaScript library).
You can get the value of the response from the responseText property once you know the response came back successfully. Specifically take a look at where the processReqChange function is defined, your code will go in there (or your equivalent of that function).
If you want to explore JavaScript frameworks, take a look at how much less code you need if you use jQuery get (for example).

asp.net webservice with jquery on different domain

I got to work on PHP app which requires a webservice call to an Asp.net webserivce. Client insist to call this webservice with POST directly via jquery.
My knowledge says its not possible to call different domain webservice from JS and I'll have to create a proxy page to consume this webservice.
So I just want to confirm, is there any hack around to consume webservice directly from jQuery POST call and parse response (Which is XML not JSON) on page.
Thanks
No there is no way around it x-browser. Server Proxy or json-p are your choices.

Resources