I'm developing a POS standalone Desktop application uisng SQL Compact, C# WPF , i want to save the user name and password and some user related settings details in the local desktop .
can i use registry for this purpose ? if so please guide me how to do this.In my recent coding i used binary files (.dat or .bin ) to store the settings information. now iam trying to look for other options. XML is not secured as one can read the file easily.
You Could use the windows registry for the users from the computer, if that user logs in to the computer your pos will auto log that person in to the system.
You can have the pos make a secure backup of the registry as user info is added. Now as far as adding other information to the registry it can be done but not very easy.
As a user logs into the system they become the curent user on a stand alone system. If this will go on a network domain then you should use active directory for your user information.
How to access to Registry using C# you can find here. But, I'm not sure that is such a good idea - you can store data in a file - even in an XML. You can crypt the data - in that case it will not be readable to anyone.
Related
I'm basically trying to encrypt a file within the UWP app that will be saved to OneDrive (already have successful code on saving file to OneDrive location) so that the same user can then load that file into another copy of the same app that is installed on a different Windows PC/Device or within the same app on the same PC (already have successful code on restoring the file into app on different and same device) but have it decrypt automatically for that specific user so that their data is secure while stored in OneDrive. I don't want another logged in user on the same or different PC to be able to restore the file into their copy of the app if it did not originate from their app. Any actual code would be greatly helpful. I just need code to encrypt a storagefile within the storagefolder so that the app uses a key or some sort of descriptor for the current Microsoft account that obtained the app from the store across all devices that same user installed the app on. I do not have any code for the encryption as I do not know where to begin.
For data protection, you could refer to Data protection document, it tells how to use the DataProtectionProvider class in the Windows.Security.Cryptography.DataProtection namespace to encrypt and decrypt digital data in a UWP app. The document contains segment code that you could use directly.
I don't want another logged in user on the same or different PC to be able to restore the file into their copy of the app if it did not originate from their app.
OneDrive file could be accessed by the specific user, it will not restore the file for other users, it is security for protecting user's data.
For the program I'm writing in vs C# wpf I need to store some user related information on the user's computer. As far as I knew this has almost always been done by creating a folder in C:\Program Files and adding whatever program related info to that folder in subfolders or whatever. After doing some browsing I came across a lot of people saying that this method is out of date because sometimes access may be denied to create a folder there, it only works for administrative accounts, etc.. One site suggested saving to c:\users\username\appdata\roaming or c:\users\username\appdata\local. So my question is what is the best and most up to date method for saving program data to users computer?
Also take a look at this MSDN article.
It is mainly for UWP apps but you will have a general idea what to put where even if you are developing a WPF app.
You may need these folders:
Environment.SpecialFolder.ApplicationData
Environment.SpecialFolder.LocalApplicationData
Environment.SpecialFolder.CommonApplicationData
Take a look at this microsoft developer blog Where Should I Store my Data and Configuration Files if I Target Multiple OS Versions:
Here is an example where you can store your Local per user configuration files
Configuration data files that the application uses and is unique per user. It stays local to the individual machine and is not synchronized via Active Directory.
Example: MyMachineSpecificData.xml
Windows 7: %USERPROFILE%\AppData\Local\<MyCompany>\<MyApp>
Vista: %USERPROFILE%\AppData\Local\<MyCompany>\<MyApp>
XP: %USERPROFILE%\Local Settings\Application Data\<MyCompany>\<MyApp>
So basically per user config files should go to:
%USERPROFILE%\AppData\[Roaming,Local]
If those configs should be available to all users then:
%SystemDrive%\ProgramData
For per user data you can use Libraries. For user independent access C:\Users\Public.
Additionally you can also use windows registry to store your configurations.
I have multiple windows store apps of a company and all of them have signing in option. What I am trying to do is create a mutual login system for all of my apps. In simple words, If user log into one app then he automatically signed in other apps.
I am using sqlite locally to maintain user's session data. So, I tried to access the one App sqlite file from other app by giving a static path to its installed location. But it won't open the sqlite file.
Can I put this sqlite file in any folder where other apps can access it too?
Is there any common folder/storage space in windows store app where other apps will be able to access this sqlite file?
Any help would be really appreciated, Thanks in Advance!
Although it doesn't help right now, Windows 10 does have a solution for apps from the same publisher sharing data. You can use ApplicationData.GetPublisherCacheFolder(folderName) to get access to one or more folders that you share amongst your apps.
As far as I know there is no common storage between apps. The best you can do is to store the sqlite file somewhere locally (let the user choose) and then hold permission to access that file in the MostRecentlyUsedList
This will allow your app to access it at any time. However, the user will have to manually open the file at least once with each app that needs to use the login.
The only way I can think of to do what you're trying to do without user interaction would be to write your own server backend and use the IP address / user agent string and other variables to uniquely identify a device. When the device logs in then all other requests from that device would be considered "logged in" until the user logs out from one of them.
This would be very insecure and I would not recommend it. Anyone could impersonate the user if they knew enough about the device they were using, and were behind the same router.
I'm writing a service using C# that is supposed to run on a Windows platform as the "local system". I can store small amounts of data in the registry, but if I want to store more data in a file, where do I place such file in? And also how to protect that data from a modification by users with lower access rights?
General approach is to use ProtectedData class to encrypt the data, then store them anywhere on the disk where the application can (eg in a subfolder of LocalApplicationData special folder, whose location you can obtain using Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData call).
Update to previous answer that may save some troubleshooting time to people using this solution (as I don't have enough reputation to comment):
For Local System Windows service account, Environment.SpecialFolder.LocalApplicationData
may also be resolved to
C:\Windows\SysWOW64\config\systemprofile\AppData\Local instead of C:\Windows\System32\Config\SystemProfile\AppData\Local.
Using the already mentioned CommonApplicationData instead of LocalApplicationData does not bring this issue.
Information source: https://www.jamescrowley.net/2014/02/24/appdata-location-when-running-under-system-user-account/
My application is hosted on IIS 7.0. There is a scenario where end user save the image (from my application) into his/her machine. Now my question is can we make a default folder in end user machine so that every time when user save the image , it will automatically save on the default folder location that we have created from our application. And please let me know how to create the folder in client system.
Please suggest me. Thanks in advance
No, this is impossible.
(At least under standard security conditions. If you limit your users to, for example, Internet Explorer on systems with your custom written signed ActiveX control, then it might become possible)