Updating A Small Application - c#

I've made a small application for fun and I want to implement an update feature.
I don't really have a remote server or anything. I thought I could use a file hosting site to host my application. So :
Does anyone know a good site which I can easily download files from? (not like rapidshare that you have to wait. more like a direct link.)
How can I make the application check if there is an update.
DONT link me to CLICK-ONCE, it seems way too complex for my needs. I just need a creative solution so that my program can ask : "update available?, if yes, give me the link".

You can use Amazon Web Services S3 and CloudFront to host your application files. If you don't want to use ClickOnce, you could simply have the application download a text file that has the latest version number from a predefined update site. Have your program compare it with the current running version and if there is a new version available pop-up a message with a link to download the new installer.
Whenever you have a new version, simply upload your new installer and update the version text file with the new version number.

Related

File Drag&Drop from Browser to Browser

My asp.net web application is some kind of "document managment system" saving files in the file system of the server.
The stored files are shown in an asp:ListView control and are downloadable as HTTP- Download. But I also want to drag&drop them into another browser window to upload the draged file to an cloud storeage like dropbox or google drive oslt.
I did some research and I didn't find any solution for this problem. I don't know if this is even possible. Maybe someone has an idea how this could be done?
I am pretty sure you can't have a web application doing that for you because it involves having your web language interacting with your computer, to move a local file to another window or tab in the browser.
It would be similar to have Javascript accessing your local files without the user "help". That is not allowed.
Rather than doing that, why not connect to Google Drive or Dropbox API and make the upload yourself?
In the piece of code where you trigger the download, you could also trigger an upload to the desired service.
Here are the API Documentation for the mentioned services:
https://www.dropbox.com/developers/documentation/http/documentation#file_requests-create
https://developers.google.com/drive/api/v3/manage-uploads

How do I use Git on my C#.NET azure website for user content updates?

Motivation
We are developing an Azure website in C# ASP.NET MVC and we want to improve cooperation with our clients/admin users who optionally co-develop "content" of the website with us.
The application generates different outputs based on user defined "parameters" (plain data stored in SQL Database) interpreted trough user defined "fcs templates" ("application specific script source files" currently stored in blob storage).
We manage the C# code in a private repository (GitHub) and regularly deploy the binaries from Visual Studio via web deployment process. This works great.
We manage the "fcs templates" on another GitHub repository which is accessible also by the client and we upload them on demand of us/admin-user to blob storage, where they can be accessed from the application (cached locally in memory and maybe later in local cache/disk).
Later on, we would like to have the application checkout and use the "fcs templates" directly from GitHub as smartly as possible and based on the user web request. Possibly even to have "more working directories" to sandbox development branch separate from the master branch of the "fcs templates", so that users can test the impact of their change before they confirm it for other users of the application.
I know that thanks to Kudu, there is git installed on the VM hosting my website, and I may take the risk and try to somehow "shell git" create some working directory in "D:\home\site\wwwroot\my_fcs_branches_mess", but I want to stick as much as possible to the Microsoft "game rules" for c#.NET web app development and deployment and avoid too much of undocumented hacks. Still, I am willing to take a little risk, though, if it will look promising based on your feedback.
I want to stress out, that I am not asking for automated git deployment of the C# application, which surely is possible with kudu. I do not want the user to deploy the whole application, but only update a small subset of the user content.
The actual question
Is there a way to take advantage of git on the actual VM where my standard azure website is deployed so that our application can use for the client modifying the client content "fcs templates"?
Does someone use Git to manage not only the actual source code but also the user content of the website? How?

Select a file from user local machine in .Net MVC C# web application?

I have a .Net MVC C# web application. User needs to select files and uploads to server. For simplicity, let's assume just 1 file a time. Before upload the file, I want to check where the file comes from. In order to do that, I need to get the file's full path on local machine to validate the file. The path has all the information for the validation.
So, the question is: how we can have user select a file from local machine, and we can get its full path? Is it possible?
Or, this is impossible in web application and has to be done in desktop application?
Thanks
You can't for security reasons. It might have been possible on older browsers, but modern versions won't allow it.
In Chrome it won't even display the file path of a selected file in the control, instead showing C:\fakepath

C# local application, to fetch variables from website in an open tab

I am trying very hard to find a way to allow exchage of information between an application running locally (made in C#) and an web application residing in an open tab of any web browser.
That is the typical user case:
User login to the .NET MVC web application using their username and password. Once logged in they are assigned a guid and they are redirected to www.myapp.com/view/[guid] . Once there they are prompted to download and run the local application (or if it's already downloaded, to run it).
Once they run the application, it should detect the [guid] and start posting information to the server www.myapp.com/postInfo/[guid].
Originally I thought about using ClickOnce and passing parameters to the clickonce launcher (?guid=[guid]). But clickonce is only supported in IE - chrome and firefox require a plugin which is a showstopper for me -
Then, I throught about using flash in the webapp to paste the guid in the clipboard, and have the local app constantly check the clipboard, but I don't think this is an elegenat solution, as it will erase the current contents of the clipboard.
Any thoughts on how this can be implemented?
Can you not package a file with the downloadable with the guid in that?
When the app starts; read the guid from that file.
or even better edit the app.config for that application prior to making available for download...
Another route would be altering the .exe prior to making available for download... Modify Emdeded String in C# compiled exe

How to change Log Level in a windows service

I am running a website and a windows service . I am able to change at runtime the level of log of my Website using a page I made, and I would like to do the same for my windows service( ie: using a page to monitor the different levels of Log I am using in the service).
Would you have some tips and tricks to achieve that? Or should I resign and upload a new version of the log4net file every time I need to log things a bit more in details (this upload is a bit tricky and quite annoying to do)?
thanks for your ideas,
[EDIT]
UNfortunately none of the answer listed here are aimed at my problem. Mine is to access the log4net from a service located on a Machine A from a WebSite running on a machine B. So that accessing the Web of MAchine A may allow me to change log level of service thread of Machine B.
If your windows service is using ConfigureAndWatch you should be able to edit the config file just like you do for your website with that page you made if you place the configuration file in a place that is accessible via the web page.
You will also have to change the path to the configuration file you load in your windows service but this should be a solution.
You can modify a config file and have your application pick up the changes. The trick is that you cannot use the app.config/web.config file to do so. Otherwise, it takes a reboot of your application before the changes will take place. Here is a SO question that has a couple answers that might work:
.net dynamically refresh app.config
You can also make changes through code like so:
http://weblogs.asp.net/psteele/archive/2010/05/03/tweaking-log4net-settings-programmatically.aspx
Ok only things I found, it to interface my service and Web Application to access the same table in the database, and make regular check to this table to change log level in servizio.
If someone has a better idea, I am all ears.

Categories