Ad
Xamarin Android FTP Authentication Problem On Startup
I'm developing an Android application in C# language with Xamarin. In this application I need a service that starts after the device boot and upload files in a FTP server. If I start this service with a button click action all works good, but if I use a BroadcastReceiver and I intercept the BOOT_COMPLETED event to start the FTP connection, I receive this error:
ex.Message: The authentication or decryption has failed.
ex.StackTrace: at System.Net.FtpWebRequest.EndGetRequestStream (System.IAsyncResult asyncResult)
at System.Net.FtpWebRequest.GetRequestStream ()
at TestProject.FTPUtility.upload (System.String userName, System.String password, System.String sourceFile, System.String targetFile)
I don't understand why I receive the authentication or decryption error only if the service starts on startup. I tried also to start the connection only after a ping success (to wait the device internet connection) but nothing is changed.
Ad
Answer
I solved the problem with this line of code:
System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
Ad
source: stackoverflow.com
Related Questions
- → How to Fire Resize event after all images resize
- → JavaScript in MVC 5 not being read?
- → URL routing requires /Home/Page?page=1 instead of /Home/Page/1
- → Getting right encoding from HTTPContext
- → How to create a site map using DNN and C#
- → I want integrate shopify into my mvc 4 c# application
- → Bootstrap Nav Collapse via Data Attributes Not Working
- → Shopify api updating variants returned error
- → Get last n quarters in JavaScript
- → ASP.NET C# SEO for each product on detail page on my ECOMMERCE site
- → SEO Meta Tags From Behind Code - C#
- → onchange display GridView record if exist from database using Javascript
- → How to implement search with two terms for a collection?
Ad