Internet disable programmatically - c#

I made a cybercafé application where the internet connectivity is a vital issue. I want to disable the internet connection until any user login in my application.
At first the task is done by disable the Proxy server. But this is not a perfect solution for me because my users use Mozilla Firefox which facilitates some network settings like use no proxy, use system proxy, auto detect proxy or manually configure proxy. So when a user changes those settings from system proxy to no proxy, then my application fail to stop them from browsing.
Please give me some example. I made this application using C#, WPF, SQL server 2008.

To be reasonably certain that there is no access you would have to write an NDIS filter driver.
This should give you full control over the network, including the ability to block all internet access to anyone except your application (or including).
This is fairly complex and requires learning driver development, and can't be done in c#.

Related

Connecting to VPN stops UWP apps internet communication

I am making an app which requires connecting to a specific payment gateway. This payment gateway restricts us to use its VPN for communicating with its API. The problem is as soon as I connect to this VPN, internet connectivity for UWP apps stop functioning. First I thought its problem with my app but even standard apps like Store and Edge browser even doesn't work. Please let me know a workaround to make UWP apps to function with VPN. Since other apps apart from UWP function properly like Firefox, IE, etc easily open up web pages. Skype desktop works... its just UWP apps which don't work.
Thanks in advance.
This will depend on how you are creating the VPN Interface and what the expectation for routing as well as the Interface classification is.
Classification : Network classification such as Private, Public, Domain. You can check the interface classification by running the Powershell Commadlet :
Get-NetConnectionProfile
This will impact the UWP traffic since, if the traffic is trying to go through the VPN, it will require the Private Networking Capability to be able to go through an Interface marked as Private (and there are no other Network Isolation rules set)
More details for at : https://msdn.microsoft.com/library/windows/apps/hh770532.aspx
To check if this is the issue one quick way would be to try using an inbox tool from an admin command prompt as follows
checknetisolation Debug -n=<Package Family Name>
You can get the for an app by running the Get-AppxPackage commandlet in Powershell. With the above command, you will be prompted to use the app and reproduce the issue. Once it has been reproduced you will come back to the app and hit Ctrl + C and it will display if it detected any Drops due to incorrect Capabilities.
Routing Now in general when a VPN connection is made and no routes are set it is marked as a Force Tunnel VPN. What that means is that the Default route for other interfaces gets disabled and the VPN interface's default route gets prioritized. I am not sure if this is your intention. If you only need to use the VPN to communicate with the Payment Gateway, you should consider making the VPN split tunneled after which apps like Edge and Store should continue working going over the physical interface and your App will work as long as it has the Private Networking capability.
From answers.microsoft.com (Thanks to "Ovidiu Cimpian")
go to Control Panel\Network and Internet\Network Connections
open the adapter for the vpn.
Right click -> properties and go to Networking tab.
Select internet protocol version 4 (and/or 6) -> properties -> advanced
deselect Use default gateway on remote network.

Low level HTTP filtering for Windows

I would like to implement a parental control for all browsers in Windows. I am thinking in a .NET application.
My first thought was create a local HTTP proxy (like Fiddler), even use Fiddlers embeddable API. However this proxy easily can be workarounded even by a kid, just (re) setting the browsers not to use this local proxy.
So I've concluded I have to go deeper.
My question, am I right? ...and how and where...
Thanks in advance
The "official" way to do this would be to build a filter atop the Windows Filtering Platform; it's designed for this sort of thing, and it's how Windows' own Parental Controls feature is built.
Having said that, you can build a Parental Controls application using FiddlerCore. You would then use Group Policy to control proxy settings (Create a REG_DWORD named ProxySettingsPerUser with value 0 inside HKLM\Software\Policies\Microsoft\Windows\CurrentVersion\InternetSettings\) such that the settings cannot be changed by non-administrative users.
You could further bolster this by applying Firewall policies such that direct egress is blocked and only traffic going through Fiddler is permitted to leave the box.
You probably won't be able to do it with .NET. If you want to see all HTTP traffic regardless of the browser settings, you'll need to either hook into every process and override calls to the sockets API, or get into the network driver layer and see the communications there.
.NET is wrong for both - you don't want to attach a .NET DLL to non-.NET processes, and you don't want to create a .NET driver.
You'll also need to somehow override the DNS, because otherwise you'll have no way to prevent HTTPS access - you can't monitor HTTPS, you can only prevent it.

c# surfing the web with vpn

im thinking on building a simple software, that can I surf the web with,
using the WebBrowser object. but, making sure that im under a vpn or proxy.
im wondering if it is even possible, to connect to a vpn or proxy service with some api
and, get a new ip every an hour or time i choose.
if its possible, can u give me some refrences?
like, what do i need to learn to achive this?
This is actually quite simple, here's an example to get you started with the WebBrowser control, you can have this up in minutes. Web Browser Example
After this you're just adding the logic for your VPN or proxy, which is completely dependent on which you choose.
This might help if you're trying to not affect the system settings for IE: Proxy Settings
Although if you can, it's likely easier to just set them in the registry if you don't mind affecting IE. This on changing the registry: Proxy Settings in the Registry
As far as information specific to how to obtain a proxy, authentication, etc, you'll need to pick a proxy service you want to use and read up on them. That should simply be a search engine research project.

online database for C# window application

I'm going to develop a POS system for medium scale company
and the requirement for me is to make all data on time for all of their branches
while in my mind, move the server from local to web would solve this problem
but, i never done any online server for window application
may i know what is the best option for use as secure database ?
such as SQL can handle this well ?
i tried to google but all of the result return is not what i want
may i know what will you do when you facing this problem ?
my knowledge on coding is just VB and CS
also SQL for database
i would like to learn new if there is better option
i hope it is impossible to access by anonymous and it is store secure at back-end only
What you probably want to do is create a series of services exposed on the internet and accessed by your application. All database access would be mediated by these services. For security you would probably want to build them in WCF and expose them through IIS. Then your Windows application would just call these services for most of its processing.
If you design it properly you could also have it work with a local database as well so that it could work in a disconnected manner if, for example, your servers go down.
Typically you don't move the server off of the site premises.
The problem is that they will go completely down in the event your remote server is inaccessible. Things that can cause this are internet service interruption (pretty common), remote server overloaded (common enough), basically anything that can stop the traffic between the store location and your remove server will bring them to their knees. The first time this happens they'll scream. The second time and they'll want your head due to the lost sales.
Instead, leave a sql server at each location. Set up a master sql server somewhere. Then set up a VPN connection between the stores and this central office. Finally, have the store sql boxes do merge replication with the central office. Incidentally, don't use the built in replication, but an off the shelf product which specializes in replicating sql server. The built in one can be difficult to learn.
In the event their internet connection goes dark the individual stores will still be able to function. It will also remain performant as all of the desktop app traffic is purely to the local sql box.
Solving replication errors is much easier than dealing with a flaky ISP.
I would recommend you to check Viravis Platform out.
It is an application platform that also can be used just as an online database for any .NET client with the provided SDK. It has its own generic windows and web clients and some custom web solutions for some specific applications.
You may be using it as a complete solution or as a secure online database backend.

Best way of executing code over the internet

basically, I am needing to execute a program on the viewers computer through a website. This program must be capable of talking to device drivers however, which makes it an unlikely candidate for activex. The website will only be used by clients(as in, it's not a public site) so having to change security settings isn't too big of a deal.
Also, we could possibly have them install an application on their computer, and then when they click a button on the website this activex control just executes the application they already installed to avoid device driver problems..
Does anyone have any ideas on how to do this well? I have a feeling activex won't just let you arbitrarily execute local applications. Also, it is preferred to be possible to do without certificates and signing(though it will eventually be over https)
(it's only tagged C# because that's the programming language to be used on both the client and server)
If you only need to tell the application to simply launch or launch with certain data, you can look into registering a protocol handler and create links, that the user can click, similar to myapp://the/data/you/need/to/send.
It sounds like you will have control over the client and server sides, so why not use WCF and set up the client application to connect to the server via a duplexed communication. On the server side keep a list of the clients that have connected to it and then when you need to trigger the client side code it will iterate over the list of clients and send the message to execute the code. And when the client disconnects it will be unregistered from the server.
See this link for more information on the duplex services.
Also, we could possibly have them install an application on their computer, and then when they click a button on the website this activex control just executes the application they already installed to avoid device driver problems..
Ding ding. That's pretty much what you'll have to do.

Categories

Resources