473,513 Members | 2,624 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 4007
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.config. 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" ?>
<configuration>
<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.Configuration.ConfigurationSettings.AppSett ings["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.config 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
"appSettings".
--
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" ?>
<configuration>
<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.Configuration.ConfigurationSettings.AppSett ings["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
2508
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 ------- ...
7
11456
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 (...
8
2996
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...
11
3586
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...
1
2793
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...
3
3135
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...
10
4234
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....
11
4346
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...
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...
0
7259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7380
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7098
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...
1
5085
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4745
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...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.