Can I create public/permanent files from Xamarin App? - c#

I'm making an App where I need to create CSV files with data I need to load in a software in a Windows machine. I want to connect an Android Device via USB to a computer and get the file from there. Is there any way I can create a file that's visible for a computer?
From what I've found you can only create cache files and files only visible to the app (neither my PC or the File Manager on the phone can see them).
I thought about creating a service in the network and send the data to that and create the file in the server but that would add more failing points and of course is more work, besides sometimes the app could be running in parts where the Wifi doesn't get to it and would mean I would have to do a temporal file and somehow upload it when it connects back, so not practical at all.

Of course you can create files and folders on external storage of the android device, which is publicly accessible. Refer to this guide.
Note: You need to get permission WRITE_EXTERNAL_STORAGE to write and READ_EXTERNAL_STORAGE to read from device's external storage.

Related

What's the best and secured way to enable winform application to access network files?

I am developing a windows form program in C# .Net and I need it to read and write files from/to a folder on a computer (let's name the computer SERVER_PC) on the wireless network which connects only 5 PCs. Basically, users should not even know about the files outside my program. I mean they shouldn't' read or write files to SERVER_PC directly. only the program should be able to connect to that folder on SERVER_PC and open the files for them.
DO I need to create a home group just for this purpose? Is this a secure way of handling it? Can I grant (read, write) permissions only to my program?
I am running windows 7 on all network PCs
(NOTE: We don't want to use domain controller for this.)
I really appreciate your help. thanks a lot
You could have a server app and a client app that transfer files using tcp sockets.
The server could provide a list of filenames to the clients. The clients could then request a file or files, the server then sends them then the user could save them back effectively sending them back to the server app which would then save them.
You could then restrict access to the folders to the user the server app runs under.
You would need to handle issues with more than one person working with a file though, unless you gave each user their own folder.
if you wanted to get more secure, you could encrypt the streams being sent between tcp end points.

Automatically upload newly created files to an SFTP server

An ASP.NET application (running on Windows server/IIS 7) has to transfer big size files uploaded by current user to an external SFTP server. Due to the file size the idea is to do this asynchronously.
The idea is that the ASP.NET application stores the uploaded file on a local directory of the Windows server. The current user can continue his work. A Windows service or a Quartz job (other tools(*)/ideas?) is now responsible to transfer the file to the external SFTP server.
(*) Are there existing tools that listen on changes of a Windows directory and then move the files on a SFTP server (incl. handling communication errors/retries)?
If there is no existing solution, do you have had similar requirements? What do we have to consider? Because the connection to the SFTP server is not very stable we need an optimized error handling with auto retry functionality.
To watch for changes in a local directory in .NET, use
the FileSystemWatcher class.
If you are looking for an out of the box solution, use the keepuptodate command in WinSCP scripting.
A simple example of WinSCP script (e.g. watch.txt):
open sftp://username:password#host/
keepuptodate c:\local_folder_to_watch /remote_folder
exit
Run the script like:
winscp.com /script=watch.txt
Though this works only, if the uploaded files are preserved in the remote folder.
(I'm the author of WinSCP)

Unable to access images folder present in another machine from Android app through Wifi

I got stuck in my application with images part, when trying to access from Android app, where the images are located in remote machine and need to access through WiFi connection.
Here is the complete scenario of my application.
I have an windows application which will save images to the folder where application got installed. dotNet application saves and retrieves images without any issues.
But I have android application which consumes wcf service (both windows and wcf). Consuming service part is also working fine in android and windows application.
Problem arises with images. Actually in database I am saving image location rather than saving the image as a byte array. But android app unable to access the location of the images folder. Because the location where application is installed was unable to access through LAN or Wifi using the URL like "IP Address/AppInstalFolde/LocalImages/ABC.jpeg."
I tried to allow access to that machine by sharing that folder across LAN, but still I could not able to access the images from Android app
I have tried with all possible ways and now in the situation that I cannot make a whole application change by allowing to convert an image to byte array in the database.
I am looking for alternative way to solve this problem.
Any help highly appreciated.
You can host a website, contains all the images in the IIS (The same as hosting WCF services). And then the Android App will connect to the website to get the images.

How to Play Video File On D Drive In WinRT?

Using XAML C# in Windows "Metro" Apps how do I go about playing a certain video file. Examples:
D:\video1.wmv
\\MEDIAPC\video2.wmv
The only way I managed to get this working so far is by using FilePicker, but I don't want to use this as I already have a list of files to play.
I have tried to use GetFileFromPathAsync but I keep getting permission / access issues
await StorageFile.GetFileFromPathAsync(#"D:\video1.wmv");
Apologies if this has been answered I just couldn't find an answer that fits my problem.
If your D:\ drive is a non-network resource try adding the Removable storage application capability. This can be accomplished by double-clicking on the Package.appxmanifest and navigating to the Capabilities tab. By default your application (assuming it is a Windows Store app) only has access to local files packaged with your app or files stored in local/roaming/temp folders (usually reserved for Application state).
If your data is stored on a Network resource that requires authentication you will want to enable the Enterprise Authentication capability.
You may also want to fiddle with the Home and Work Networks for the \MEDIAPC\ files if you aren't accessing resources that require network authentication.
Further Reads:
Accessing data and files
How to load data from files
App Capabilities Overview

Access Database on server, installing an applicaiton that uses access database

1) I am developing a desktop application that connects to a access database to store some information. This access database is on a server. I can get to that server using FTP sequence. The server also has the capability to establish connection to access database. Right now, my application downloads the database file into a folder on the computer edits it and puts it back on the server. I would really love to know if its possible to connect to the access database, make changes to it all without downloading it so that I can save time.
2) If its not possible to do what I was asking for in question 1. Say, I share my application with my colleges and I want them to be able to do the same with the database editing. after I make an .exe file out of my project and send it to them. Do they need to install ACE.oledb.12 on every computer that I want to run it on?
As Access is a file based system rather than a dedicated database server, "remote connections" don't exactly exist as all data processing has to be done locally. However as long as you are able to setup either a VPN to the server where the Access file is stored, or even better map the path as a network drive then you should be able to access it without having to download the file first. If you only have FTP access though then it wouldn't be possible.
If all you are using is Jet/ACE, the database that Access normally uses, the other users will at least have to have the drivers, which are free, or if you are working within Access itself, you will need the runtime, also free.
Actually, your terminology you using is wrong. You don't connect to a word file. You don't connect to a power point file.
So you have to keep in mind here you are not really connecting to some text file or mdb file that just happens to be sitting on a hard drive.
You are thus simply opening a file.
I mean it is silly to say we connect to a word file, or we connect to a Power point file. So in the case of the office suite and those basic simple files that resides on the disk drive?
We are talking about plane Jane windows file.
A horse is a horse is a horse.
A file is a file is a file.
So you don't connect to the jpg file sitting on the hard drive, you OPEN the jpg file. So if you talking about your current setup it best to use the correct terminology here. You are not connecting to that Access accDB file, but are in fact opening a PLANE JANE windows file. If you look close at your connection string, it will ALWAYS have a fully qualified windows path name in it that resolves to a file sitting on a folder.
So if you place that file on some server, say web server, then then you still faced with having to open that windows file. This is NOT ANY different than wanting to open a power point file. That means if you going to connect over the internet then you need to EXTEND the windows file system (this means you will need some kind of VPN). At the end of the day, if you cannot use windows networking to browse and open the folder where that file resides, then you cannot open that file with Access (or more specific in your case the JET data engine).
So for example, if the server where the file resides is a non windows box, say Linux, then you need to "add or use" or "install" the windows file and networking system on that box. A common choice in Linux is to install and run Samba on that computer.
Keep in mind that in the case of using SQL server, then you are connecting to a SERVICE running ON THAT server. In this case then you not opening a file on the remote box, but are simply are using a socket (TCP/IP) connection to some service. So you not just opening a silly old windows file that happens to be an accdb file on that system in this case.
So as such when you use FTP or http, these are not real "windows" networking systems that allow you to open + use a plane Jane windows file.
FTP will require the WHOLE FILE to be downloaded local.
PROBLEM!
If the web site or web server has the accDB file open, then how are you going to have the web server CLOSE the file BEFORE you upload and OVERWRITE the file? In other words, if that file is open by the web server, then you should NOT be making a copy and even downloading a copy via FTP until the SERVER AND WEB SITE CLOSES THE FILE! This means you NEED permission to STOP the web server while you do this!
So as such, just keep in mind the concept here that you are NOT connecting to some file, but you are just going to OPEN the file. You need to be able to OPEN the file, and you need to be using the windows networking system to do this open file in the case of Access. I mean, you don't have to install Access(JET) on the target computer. You don't have to install Power Point on the target computer to open a power point file.
You don't have to install word on that system to open a word file.
You don't have to install Excel on that system to open an Excel file.
So you are ONLY opening a file that just happens to be on some other computer.
So the Access database engine and software MUST be installed on your computer (no .exe possible here). You can most certainly package up your application as an installable windows application that then can be installed on each computer. So a free edition of the Access runtime is available, but you still going to have to install that free version of Access on computers that use Access, even if it is the free runtime edition. However, these days, I not really aware of any popular development system that produces just .exe files without requiring a runtime of some kind, be it .net, VB6, Java, or in this case Access – so some kind of support and runtime files are quite much a common requirement in most systems in use today.
So, just keep in mind you are opening a plane Jane windows file.
As such, your path name of http, or FTP is not a allowed windows path name and is not a windows file/networking system. As such a path name has nothing to do with windows networking and opening of a simple file sitting on the hard disk. So HTTP or FTP etc. are not based on windows networking and file system.
I don’t think this basic concept is too hard to grasp, but at the end of the day the concept you need to grasp and learn is that when you open a windows file sitting in a folder on the hard drive, then then will you need the windows file system to open such files. The idea and concept of opening a file in a folder might be new to you, but it is a basic requirement and understanding you need to solve this issue.
As noted, you can consider a VPN, but I explain why such a setup is not going to work in this article:
Using a wan with ms-access? How fast, how far?
http://www.kallal.ca/Wan/Wans.html
(do read the above – as it explains that you CAN open such files over the internet, but ALSO explains that such connections are WAY TOO SLOW! – remember high speed internet is WAY TOO SLOW here for this use!).
I suppose another possibility would be to consider the new web publishing ability that Access has. In the following video note how I switch to running the Access application 100% in the browser. The resulting application does not need any ActiveX or Silverlight. So the web pages run + work fine on my smartphone and even my iPad.
http://www.youtube.com/watch?v=AU4mH0jPntI
So you can use the new web publishing feature, and that would allow one to use http: to use the application

Categories

Resources