473,662 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Store program data

Hi everyone.

I would like to ask about good habid, of keeping program data.
I have written in C# Server and Client applications, and now i need to
care about authorization.
What i mean is that Server should allow login only authorized users -
Admin of the server should have good and comfortable acces to
"permitted users list", with opportunity to add or remove entries in a
good way.
Program should also keep info. where to store received files. This is
also the thinkg that might by changed by administrator of the server.

Where and how o keep this informations.
Should i use XML, or create ini file. Where to place this files.
Program directory or somwhere else.
Thank you for your time and advice.
PK

Dec 3 '05 #1
4 4013
Generally speaking, configuration settings such as where to store files are
kept in the app configuration file. If you add an app.config file to your
project, this will be automatically converted / deployed to the build folder
as yourapp.exe.con fig. You can either use the appSettings section or a custom
config section to read these settings.

Regarding authentication data such as username / password pairs, unless you
have only a small amount of data, the best place to store this is in a
database and create a method that looks this up based on login parameters
supplied by the user.

Theses are not the only ways to store such data, but hopefully they give you
some ideas.

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Piotrekk" wrote:
Hi everyone.

I would like to ask about good habid, of keeping program data.
I have written in C# Server and Client applications, and now i need to
care about authorization.
What i mean is that Server should allow login only authorized users -
Admin of the server should have good and comfortable acces to
"permitted users list", with opportunity to add or remove entries in a
good way.
Program should also keep info. where to store received files. This is
also the thinkg that might by changed by administrator of the server.

Where and how o keep this informations.
Should i use XML, or create ini file. Where to place this files.
Program directory or somwhere else.
Thank you for your time and advice.
PK

Dec 3 '05 #2
Thanks. That's the way i will implement this.
BTW.
I have added config file, as you explained.
It's of the form:
<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>
<AppSettings>
<add key="Key1" value="Kevin" />
<add key="Key2" value="150" />
<add key="Key3" value="Rice" />
</AppSettings>
</configuration>

Then i try to receive some keys from xml by:
String ppp =
System.Configur ation.Configura tionSettings.Ap pSettings["Key1"];

Am i doing something wrong? I found this example on the internet, (
manually added config file ).
Anyway ppp == null
PK

Dec 3 '05 #3
The config file must be named "app.config " and be included in your project to
be translated into yourapp.exe.con fig and placed next to the built executable
after a build or in an F5 debug operation.
you might have to cast values as (string) when pulling them out with the
code you show. Otherwise, I can't see anything wrong with it except for the
fact that your appSettings element has a Capital "A". It needs to read
"appSetting s".
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Piotrekk" wrote:
Thanks. That's the way i will implement this.
BTW.
I have added config file, as you explained.
It's of the form:
<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>
<AppSettings>
<add key="Key1" value="Kevin" />
<add key="Key2" value="150" />
<add key="Key3" value="Rice" />
</AppSettings>
</configuration>

Then i try to receive some keys from xml by:
String ppp =
System.Configur ation.Configura tionSettings.Ap pSettings["Key1"];

Am i doing something wrong? I found this example on the internet, (
manually added config file ).
Anyway ppp == null
PK

Dec 3 '05 #4
Now it works.
Thank you for your time.
PK

Dec 3 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
2530
by: Colin Steadman | last post by:
Hope this makes sense! I'm building an ASP page which allows uses to add items to an invoice via a form, ie: Item No Part No Order No Quanity Units Price VAT ------- ------- -------- ------- ----- ----- --- .... ... ... ... ... ... ... <Add item> <Submit>
7
11503
by: Rolf Hemmerling | last post by:
Hello ! Beginner's question: What ist the easiest way to store and save objects in a file generated by a C++ program, by using the "standard C++ library" and/or "Standard Template Library ( STL )" ? So I would like to generate some objects ( of different classes ) with a C++ program and would like to make it permanent / persistent, so that
8
3023
by: Jaime Rios | last post by:
Hi, I created a COM AddIn for Word that performs the functions that it needs to, but I needed to add the ability for the toolbar created by the COM AddIn to remember it's last position and whether it was docked or not. I added the following code to my "OnConnection" function but it fails with an error, "Run-time exception thrown : System.IO.IOException - Bad file name or number." With applicationObject.CommandBars("SampleToolbar")
11
3602
by: hoopsho | last post by:
Hi Everyone, I am trying to write a program that does a few things very fast and with efficient use of memory... a) I need to parse a space-delimited file that is really large, upwards fo a million lines. b) I need to store the contents into a unique hash. c) I need to then sort the data on a specific field. d) I need to pull out certain fields and report them to the user.
1
2800
by: Simon1234 | last post by:
Below you will see my code to read data from a database and store it into a dataset. The first, commented code uses an SQLDataReader and the second, uncommented code uses the Fill method of the SqlDataAdapter. They both work perfectly, as long as I use a query that returns a small amount of data. When I use a query that returns all the data I need, the program slows to a crawl and begins using tons of memory. Is there a better way to...
3
3141
by: noridotjabi | last post by:
Say I'm writting a program. In this program for some reason I need to store data somewere were I will be able to access it again. I don't want to store it in a file because then it could be deleted by another program or user. So, is there anyway to save data onto a computer so that it will not apear as a file (actually idealy not apear as anything at all), but will not get overwritten by any other program or file. If this is OS...
10
4254
by: Paul Cheetham | last post by:
Hi, I am developing an application that needs to store some machine-specific settings. The application is going to be published on the network in order to keep the clients on the latest version. Because of this, I am unable to store these settings in the App.Config file, as this gets updated every time the application does, and there doesn't appear to be a way of preventing this. Most of my application settings are kept in the...
11
4370
by: c676228 | last post by:
Hi everyone, I am just wodering in asp program, if there is anybody writing store procedure for inserting data into database since there are so many parameters need to be passed into store procedure(assume there are many columns in the table). I need to insert data into two separate tables, the relation between these two tables is 1 row of data in table1 could have multiple rows in table2 related to table1, but if the data insertion into...
0
230
by: Brian Vanderburg II | last post by:
Lance Gamet wrote: Lance Gamet wrote: One way I've just started to use it to create a utility function to return the location of the user data folder, depending on the operating system: import os, sys def GetUserDataDirectory(): dir = None
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8762
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.