How to find out if a user installed my software successfully? - c#

I want to know how many users installed my software successfully.
But: I do not want to open a website link after installation.

The only way you could do this would be if your software had to be installed using some installer, and that installer "called home" to some server of yours as part of the installation process. But:
You have to have already set all of this up. If you've released your software already, it is too late ...
It is easy for someone to defeat measures like this; e.g. by disabling the machine's networking while installing the software. And a serious software pirate is likely to try to modify your installer to disable the "call home" code.
A lot of legitimate users of your software would consider "call home" during installation to be an invasion of their privacy. You are likely to get loud complaints and there's a risk of bad publicity that will damage your company's reputation.
As #Pierre 303 points out, recording information about people who (for example) install your software may be limited by privacy laws in your country.

You could use a WebRequest for a simple pingback.
int serial = 123456;
WebRequest request = WebRequest.Create(string.Format("http://yourserver.com/pingback.aspx?serial={0}", serial));
var response = request.GetResponse();
Call this on the first startup of your application and store a flag in registry to remember if the pingback is already send.
Note: It is usually not appreciated by end users to have applications silently "phone home". You should provide some kind of notification with an accept button.

If you don't want to open a website after the installation, you should consider using a custom function that will be called by either the installer after the installation is finished or by the application at startup.
That function would call the website silentely without opening a browser.
I'm working on an open source project that will help you in that task. I'll publish the link in a week or two in this answer.

Related

Fix "are you sure you want to run this program"?

So I have this problem that when I download my software (from visual studio 2015) from the internet because I put it on mega.nz and I click download it will download it. When I try opening it to test the program it asks me: "Picture Running this app may make you computer at risk".
This software is NOT a virus and requires no admin access or anything in that sort. Some reasons I think this could be happening is because I am using web clients. <LINK REDACTED>
You can implement code signing which allows Windows to verify the origin of the executable. Then, if you maintain a good reputation with your users, the SmartScreen Filter will stop complaining.

Replacing Click-Once with another installer that supports non Windows Security

I currently have an in house C# app that is delivered via click-once. I'm moving to the cloud and would like to have the Click-Once delivered from there (will be accessed from multiple countries and I can't use IP ranges to block out intruders), but it appears that the only way to secure the download is using windows security which is not an option for my clients.
I'm looking for a nice way to deliver the initial software and then keep the clients updated.
I've heard about WIX but I can't seem to find any information around updates from the internet and it.
Does WIX support this? If so can someone point me at an example or reference?
If it doesn't support it is there another solution someone can recommend?
Here is my usage scenario:
- User logs into a website supplying credentials, (username/password or certificate) then has the ability to download and install the application.
The application must check on startup of the app for a new version and if there is automatically download, install then run it. (would be nice if the user must resupply credentials for the update but not a necessity)
Bonus points if it will work on any web server such as a simple Node.js implementation.
WiX Only handles the installation via the bootstrapper or MSI you have generated, so I would assume that it's most likely a windows installer setting of some kind when it is first created. The element ClickThrough is supposed to be able to handle this scenario, though I don't know much about that.
The way my work colleagues dealt with this is by using IIS and an ASP.NET web service, along with a DLL that has methods to check with the web service if there is an update, and then prompts the user about the update and asks if they wish to update (did I say update enough in that sentence?).
Hope this helps.

How to prevent application being marked as suspicious

I have a .NET application written in C# using Visual Studio 2012. I'm promoting the application through my own website and have it available for download. When downloading it in Chrome I get a message stating that my application is "not commonly downloaded and could be dangerous". Additionally, when I download my own application and execute it Avast sees it as suspicious and wants to run it in the sandbox.
Is there anyway I can prevent this from happening (without purchasing a certificate for signing)? I don't want potential users to run into this issue.
Edit: I am not doing anything malicious or using any hooks in my application. The application is just a small simple tool as you can see here.
Either you code-sign the App or you wait until a few thousands of people download your App, install it, not report it as garbage and then you get good-will grant from providers.
Even if your application is signed with a certificate issued by one of the CA's participating in Microsoft's Trusted Root Certificate Authority program, it could still face some issues unless you use an EV Authenticode code signing certificate and/or continue to renew the same certificate in perpetuity. See "IE9 SmartScreen Warning, Despite Following All Recommendations" for an example. In short, you're paying for reputation as a software publisher.

Rebooting Linux from PC with C#?

Wondering if anyone has a simple solution to doing a reboot of a linux box from a C# windows app. I can do the reboot using ssh, but really did not want to include the SSH lib files from Tamir Is there something else I could do besides bring in the full SSH lib for a simple reboot?
Here is how I do the reboot using Sharpssh from Tamir..
SshExec exec = new SshExec("192.168.1.1", "root", "password");
exec.RunCommand("/sbin/shutdown -r");
exec.Close();
you could send a Remote Procedure Call.
http://www.cs.cf.ac.uk/Dave/C/node33.html
Are you running Apache/PHP on the box? If so, a horribly insecure way may be to setup a PHP page to initiate the reboot. (You could attempt to add some security by requiring a login / obscure string supplied as a post variable, etc) You can then just use a WebRequest to call the page in question to initiate the reboot.
Please don't ask me about the security specifics of allowing a PHP page to call out to a system command with the required permissions - it has been far too long since I worked on Linux / PHP.

Running .net application over a network

I need to enable a .NET application to run over a network share, the problem is that this will be on clients' network shares and so the path will not be identical.
I've had a quick look at ClickOnce and the publish options in Visual Studio 2008 but it needs a specific network share location - and I'm assuming this location is stored somewhere when it does its thing.
At the moment the job is being done with an old VB6 application and so gets around all these security issues, but that application is poorly written and almost impossible to maintain so it really needs to go.
Is it possible for the domain controller to be set up to allow this specific .NET application to execute? Any other options would be welcomed as I want to get this little application is very business critical.
I ought to say that the client networks are schools, and thus are often quite locked down as are the client machines, so manually adding exceptions to each client machine is a big no no.
Apologies, I forgot to mention we're restricted to .NET 2.0 for the moment, we are planning to upgrade this to 4.0 but that won't happen immediately.
The deployment location in the manifest must match the location where it is deployed. You are going to HAVE to use a UNC path. There shouldn't be any problem with this. ClickOnce applications install under the user's profile, and require no administrative privileges. It only needs read access to the file share where the application is deployed.
The best answer is to create deployments for each school and for you to set the UNC path, because then you can just send them a signed deployment and they can put it on the file share. But that's a major p.i.t.a. if there are a lot of schools involved.
The next answer is: Who actually deploys the application to each school, i.e. puts it on the file share? Is there some kind of administrator?
What I would recommend (depending on who it is) is giving them mageUI.exe and teaching them how to change the deployment URL and re-sign the manifest (it will prompt). The problem with them re-signing the deployment is they have to have a certificate. You could give each school their own certificate (created with the "create test certificate" button in VS, or use MakeCert to create one [ask if you want more info]) or give them all the same key (not very secure, but hey, it would work).
If you at least updated to .NET 3.5 SP-1, you could deploy the application without signing it. (I'm not giving you a hard time about .NET 2.0, my company is in the same position, I'm just passing this information on.)
If the computers have internet access, you could probably find somewhere to host the deployment for $10/month, and push it to a webserver and let them all install from there. Then everyone would get updates at the same time, you would only have to deploy updates to one location. This would be the simpliest solution, assuming they have internet access.
RobinDotNet
Visit my ClickOnce blog!
On the "Publish" tab of your project properties there is a "Installation Folder Url" textbox. Visual Studio requires you to put something there. Just put in any random UNC path (\\someserver\randomfolder)
Click the "Options" button. Select "Manifests" and check "Exclude deployment provider URL". This will remove the path you were forced to add in step 1.
This should allow clients to put your deployment wherever they want. When their users install, their start menu shortcut will point back to where they put the deployment.
Here's the description from MSDN about that checkbox...
Exclude deployment provider URL
Specifies whether to exclude the
deployment provider URL from the
deployment manifest. Starting in
Visual Studio 2008 SP1, the deployment
provider URL can be excluded from the
manifest for scenarios in which
application updates should come from a
location unknown at the time of the
initial publication. After the
application is published, updates will
be checked from wherever the
application is installed from.
Perhaps, the link here could save you, if I am not mistaken, you are worried about the drive letter and handling UNC conventions? Take a look at this on CodeGuru, which contains code on how to map to a UNC share dynamically at run-time.
The problem is Security related to the .Net framework. Unfortunately i don't have much experience in this area, but maybe one of these links will help:
Microsoft is aware of this problem
Hint about mscorcfg.msc
Another hint from ID Automation
Last but not least: A google search
Can you use a UNC path?
\\\server\folder\app.exe?

Categories