I'm trying to create a WP7 application that will upload an image to my website. I tried using FTP but microsoft have removed that feature from WP7. Apparently the only other way at the moment is to call a webservice running on my website that will do the ftp upload for me.
Simple enough, i turn the image into a byte array and make a web request to my website.
But i'm not sure on the code on either side, client or server. I'm using asp but i'm not having much look, i've got as far as turning the image into a byte array but i dont know how i go about sending this data. All the info i've found is for web apps or windows forms not WP7.
Thanks,
James
Hey Cadab have you checked out this link yet? It looks like the code for the application on the client as well as server side. I have not tried this myself but I'm pretty sure it would work.
You should take a look at this question because it has code and seems pretty close to what your trying to accomplish.
You might also want to check out this question.
Although these were written in standard silverlight (browser or client) they should work for WP7 with minor modifications.
Let me know if this helps.
Related
Hi.
I have several questions. I developed an application using Visual Studio 2010. The application is developed using Windows Form and the program was wrote using C#.
This application needs to be run on a server. There are several clients connected to the server that will access and use that application through the browser. I know this can be done using Smart Client technique. But I don't really understand how to do it. My questions are:
Is there any syntax/class/methods/function that I need to include in my application? How to use it?
What settings/configuration do I need to set up so that the client computer can access the application in the server through their browser?
I know this can be done using ClickOnce but I don't know how. Can anybody tell me or show me the steps that I need to do to implement this?
Is there any syntax/class/methods/function that I need to include in my application? How to use it?
There are a few - but this is a large area. I would point you at couple:
WCF
ASP.NET Web API.
I would advise to use the later as it appears to be where the modern development is heading (at least to me).
Put simply, you will write your own web server, host it either in your WinForms application or migrate your WinForms to be a web application and host it on IIS, for example. Your web server will expose some API, which will likely to be based on HTTP protocol. A client application will hit web URLs. This will be a request-response paradigm.
Because this is a large area, I cannot name you exact classes, but have a look at ASP.NET site for samples.
What settings/configuration do I need to set up so that the client computer can access the application in the server through their browser?
It depends on the technology. Usually it's pretty simple - get it from tutorials and samples. In most cases this will be *.config file XML code and some minor bootstrapping in .cs files.
I know this can be done using ClickOnce but I don't know how. Can anybody tell me or show me the steps that I need to do to implement this?
ClickOnce is a deployment tool. You probably don't need that at this point.
After a big search i found voice recording is not possible in asp.net 4.
using plugin like flash we can achieve the same.
can anyone share the code .net voice record and play using flash player.
or if any other alternate good way to achieve this? kindly share the code.
You dont use a normal asp.net site to do stuff like this. instead you should use Silverlight or flash. both technologies let you use the mic or webcam.
http://silvoicerecordupload.codeplex.com/
Silverlight and flash can both be implemented on a website regardless of web server.
ASP.NET is a server side technology that runs on the server. Audio recording is handled on the client side.
Flash is a current client side technology that has the ability to reliably capture audio from the user microphone, encode it and:
POST it to a (ASP.NET) web server OR
stream it to a media server like Red5, AMS or Wowza.
http://audior.ec does the former, http://flvar.com does the latter.
HTML5 might become a more feasible option in the future: http://audior.ec/blog/recording-mp3-using-only-html5-and-javascript-recordmp3-js/
I have a phonegap iOS app which has a form that, when submitted, it should post some json data to a server and get a response. I have to use C# on the server side and listen somehow when the json is posted from the form in the phonegap app, do some stuff with the data and then respond to the phonegap app. How can I implement the c# server and how should I post the data from my html form? I am experienced in c# desktop applications, but I am really new to everything related to web stuff. The ios app is running in an iphone simulator on a mac in my local network. I have searched for resources but I haven't been able to do this and have been trying for a while. I think I don't need the whole code, just advice on how to do it and what to use.
Any help will be greatly appreciated.
Thanks.
ASP.NET Web Api is exactly what you need. It's a framework for creating web APIs that receive and respond to requests coming through the web, which of course includes JSON data.
ASP.Net MVC and/or ASP.Net WebAPI are perfect for this. Check out the resources at http://asp.net.
The MS Web API won't help with writing a server.
You don't need to write your own server, but you can if you so choose.
Setup and run IIS.
Make a simple ASP.NET Web Forms application
Handle the Page_Load event
Read the value of your json from the posted data using Request.Form["json"]; or whatever you called your posted fields.
System.Web.Script.Serialization.JavaScriptSerializer will help to deserialize your json. Just make a class for your types. You'll have add a reference to System.Web.Extensions.
Publish your application to IIS.
I can highly recommend ServiceStack. It's highly testable, easy to host, and in my experience magnitudes faster than any of the MS web service platforms. Plus, as you don't state what platform your server is, ServiceStack can be hosted on both Windows and Linux systems.
https://github.com/ServiceStack/ServiceStack/wiki/Mono
https://github.com/ServiceStack/ServiceStack/wiki/Self-hosting
My iOS application allows a user to store files such as PDF's, Images, etc. We need to synchronize the app files to the cloud as we also offer the user a web portal to view the same data. I use WCF (Mtom encoding/streaming) in my Windows Forms app but this is not working in Xamarion.iOS (MonoTouch). There seems to be a problem with Mtom message encoding so I'm looking at an alternate and/or better way of getting files uploaded reliably such as streaming, showing progress, and using async await in C# 5 if possible.
What method do you recommend and if you have any sample code or links this would be great. Also, what is required in IIS 7.5 as I run Windows Server 2008 R2. Lastly, any firewall issues as I run a Watchguard appliance so if I need to open anything to allow this to work please advise. I assume though this would occur over HTTP or HTTPS.
I've done some research on web client, webDAV, etc, but not sure what is really the best approach for this scenario.
Thank you.
HttpClient (async) or WebClient will handle uploads just fine. You can create an ASP.NET upload handler or MVC action to read a HTTP posted file.
Some helpful links:
C# HttpClient 4.5 multipart/form-data upload
Getting the upload progress during file upload using Webclient.Uploadfile
http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx
Edit:
See Larry OBrien's answer explaining the iOS 7 native MonoTouch.Foundation.NSUrlSession which allows background transfers.
iOS 7 introduces a new class, MonoTouch.Foundation.NSUrlSession, which is the preferred way to transfer larger files to and from the Web. NSUrlSession transfers can work when the application is in the background.
The programming model is explained in this article.
Here is a sample application that demonstrates the technique.
Do you know any cross-browser method to create and save a file with JavaScript on the client-side?
Considerations:
I can't save it on the server because the file is going to be read from a fiscal printer.
The server can't access the client. This is obvious because we are talking about a web application in the web, so the server can't access a client folder.
New ActiveXObject("Scripting.FileSystemObject"); is ONLY for Internet Explorer and even then not for all versions.
We are talking about printing on a fiscal printer, so I can't ask the cashier in the supermarket to download the text file and save it in a folder where the fiscal printer can read it.
If not JavaScript, what else can I use in my ASP, .Net 4.0, C# web application?
Basically, you said it, "we are talking about a web application." Do you know any web applications that save a file to your hard drive (besides cookies) without showing you a download prompt first?
Having said that, browsers have started to offer a persistence API that goes beyond cookies. (See, for example, this article.) But such a solution wouldn't meet your requirement of being cross-browser.
Your only options are to use persistance APIs from HTML5 or to create a browser plugin (activex control on IE, NPAPI plugin on others) that can do the file access for you. You could use FireBreath to do this, and it would be relatively simple if you know C++.
That said, it is a really dangerous idea; it is difficult to prevent people from using your plugin in other pages, so your plugin has to somehow be smart enough to keep itself from being abused by malicious sites that want to read (or even write) arbitrary data to your hard drive.
There is, after all, a reason why browsers don't natively support this. I'd look at HTML5.
you can do that by Client side Web services just make a function in web service to create a text file in your hard drive then convert the web service in to the client side service when u do that .Net framework make a client side java script then u will be able to call the server side function using Java script in client side after that your file will not be posted in the server it will remain save in your hard drive ok
we came out with a simple windows service nodejs app to be installed in the local machine.
When the web application need to create a file it just sends an API call to this app using localhost and that will write the file for it.
Cheers.