Everyone keeps telling me that I should protect my database connection
information by defining the connection string in a separate file (presumably
one that is not in the application directory).
However, I can't work out how to do this as C# doesn't seem to have an
equivelant of the C/C++ #include directive.
Can someone give me the clue.
--
Dave 8 2232
Dave <Da**@discussio ns.microsoft.co m> wrote: Everyone keeps telling me that I should protect my database connection information by defining the connection string in a separate file (presumably one that is not in the application directory). However, I can't work out how to do this as C# doesn't seem to have an equivelant of the C/C++ #include directive. Can someone give me the clue.
You wouldn't use include in C/C++ either. The idea would be to read the
information from the file at *runtime*. Defining it in a different
compile-time file hardly protects it at all - the most it can do is
obfuscate it slightly.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
I don't know why you'd want to have the connection string file on a separate
application directory, but I have done it on a different file (on the same
directory) .Here is what I have done.
I have a log in page that validates username and password from the SQL
server database (don't worry, all passwords are encrypted), so I created a
separate C# file that has a class to connect to the db. On my login page, I
created an object of the class and wala, you are ready to go.
Chao...
Now, I don't know how secure that is (I am sure some of the pundits here
will be able to answer that question), but that's my approach.
"Dave" wrote: Everyone keeps telling me that I should protect my database connection information by defining the connection string in a separate file (presumably one that is not in the application directory). However, I can't work out how to do this as C# doesn't seem to have an equivelant of the C/C++ #include directive. Can someone give me the clue. -- Dave
I don't know why you'd want to have the connection string file on a separate
application directory, but I have done it on a different file (on the same
directory) .Here is what I have done.
I have a log in page that validates username and password from the SQL
server database (don't worry, all passwords are encrypted), so I created a
separate C# file that has a class to connect to the db. On my login page, I
created an object of the class and wala, you are ready to go.
Chao...
Now, I don't know how secure that is (I am sure some of the pundits here
will be able to answer that question), but that's my approach.
"Dave" wrote: Everyone keeps telling me that I should protect my database connection information by defining the connection string in a separate file (presumably one that is not in the application directory). However, I can't work out how to do this as C# doesn't seem to have an equivelant of the C/C++ #include directive. Can someone give me the clue. -- Dave
I realised it was a stupid question shortly after I posted it. In actual fact
I would think that having the connection string embedded in the middle of a
compiled .dll was pretty secure - a good deal more secure than reading it in
plain text from another file (unless the file is encrypted of course).
I suspect that all the talk about securing the connection string is aimed at
scripted HTMl files, rather than compiled code-behind files. Nevertheless
when I create a dataconnection in ASP.NET I always get a warning asking if I
want to include the password in the connection string.
This whole security thing is a bit of a maze. Anyway, thanks for responding.
--
Dave
"Jon Skeet [C# MVP]" wrote: Dave <Da**@discussio ns.microsoft.co m> wrote: Everyone keeps telling me that I should protect my database connection information by defining the connection string in a separate file (presumably one that is not in the application directory). However, I can't work out how to do this as C# doesn't seem to have an equivelant of the C/C++ #include directive. Can someone give me the clue.
You wouldn't use include in C/C++ either. The idea would be to read the information from the file at *runtime*. Defining it in a different compile-time file hardly protects it at all - the most it can do is obfuscate it slightly.
-- Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
I realised it was a stupid question shortly after I posted it. In actual fact
I would think that having the connection string embedded in the middle of a
compiled .dll was pretty secure - a good deal more secure than reading it in
plain text from another file (unless the file is encrypted of course).
I suspect that all the talk about securing the connection string is aimed at
scripted HTMl files, rather than compiled code-behind files. Nevertheless
when I create a dataconnection in ASP.NET I always get a warning asking if I
want to include the password in the connection string.
This whole security thing is a bit of a maze. Anyway, thanks for responding.
--
Dave
"Jon Skeet [C# MVP]" wrote: Dave <Da**@discussio ns.microsoft.co m> wrote: Everyone keeps telling me that I should protect my database connection information by defining the connection string in a separate file (presumably one that is not in the application directory). However, I can't work out how to do this as C# doesn't seem to have an equivelant of the C/C++ #include directive. Can someone give me the clue.
You wouldn't use include in C/C++ either. The idea would be to read the information from the file at *runtime*. Defining it in a different compile-time file hardly protects it at all - the most it can do is obfuscate it slightly.
-- Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
Dave <Da**@discussio ns.microsoft.co m> wrote: I realised it was a stupid question shortly after I posted it. In actual fact I would think that having the connection string embedded in the middle of a compiled .dll was pretty secure - a good deal more secure than reading it in plain text from another file (unless the file is encrypted of course). I suspect that all the talk about securing the connection string is aimed at scripted HTMl files, rather than compiled code-behind files. Nevertheless when I create a dataconnection in ASP.NET I always get a warning asking if I want to include the password in the connection string. This whole security thing is a bit of a maze. Anyway, thanks for responding.
Just to warn you that it's really not secure at all to have a
connection string embedded in a DLL. Try it, then use Reflector
( http://www.aisto.com/roeder/dotnet/) to have a look at the assembly.
I agree it's more secure than a plain text file.
Quite how it should be secured depends on the app - it's usually not a
good idea to have a fixed password in the first place.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Ah yes, I haven't got my head round all this reflection and obuscation stuff
yet.
Security is not a major problem for me at the moment as it's only names and
addresses, but I still don't understand how you make the database behind a
web site really secure. (I don't understand what you mean by not having a
fixed password.) What are we actually securing against? - somebody manages to
download the asp and dll files (fairly easy) and the database (more difficult
because it's not in the URL's subtree). Then they dig the password out of the
dll (I thought DLLs were just binary, but I'll take your word that it can be
done) and open the database, bingo. So, we could put the database password in
an encrytped file, but it needs to be symmetrically encrypted as the app
needs to decrypt it, and the decrypt key will have to be built into the code,
so we're back to square one.
I'm obviously missing a trick here.
--
Dave
"Jon Skeet [C# MVP]" wrote: Dave <Da**@discussio ns.microsoft.co m> wrote: I realised it was a stupid question shortly after I posted it. In actual fact I would think that having the connection string embedded in the middle of a compiled .dll was pretty secure - a good deal more secure than reading it in plain text from another file (unless the file is encrypted of course). I suspect that all the talk about securing the connection string is aimed at scripted HTMl files, rather than compiled code-behind files. Nevertheless when I create a dataconnection in ASP.NET I always get a warning asking if I want to include the password in the connection string. This whole security thing is a bit of a maze. Anyway, thanks for responding.
Just to warn you that it's really not secure at all to have a connection string embedded in a DLL. Try it, then use Reflector (http://www.aisto.com/roeder/dotnet/) to have a look at the assembly.
I agree it's more secure than a plain text file.
Quite how it should be secured depends on the app - it's usually not a good idea to have a fixed password in the first place.
-- Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
Dave <Da**@discussio ns.microsoft.co m> wrote: Ah yes, I haven't got my head round all this reflection and obuscation stuff yet. Security is not a major problem for me at the moment as it's only names and addresses, but I still don't understand how you make the database behind a web site really secure. (I don't understand what you mean by not having a fixed password.) What are we actually securing against? - somebody manages to download the asp and dll files (fairly easy) and the database (more difficult because it's not in the URL's subtree). Then they dig the password out of the dll (I thought DLLs were just binary, but I'll take your word that it can be done) and open the database, bingo. So, we could put the database password in an encrytped file, but it needs to be symmetrically encrypted as the app needs to decrypt it, and the decrypt key will have to be built into the code, so we're back to square one. I'm obviously missing a trick here.
Well, one way is to ask for the password when you install, and install
it using the Windows cryptography API which would let only the
appropriate user decrypt it. I'm afraid I don't know much about that
kind of thing, but that would be the idea.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: wukexin |
last post by:
Help me, good men. I find mang books that introduce bit "mang header
files",they talk too bit,in fact it is my too fool, I don't learn it, I have
do a test program, but I have no correct doing result in any way. Who can
help me, I thank you very very much.
list.cpp(main program)
//--------------------------------------------------------------------------
-
#pragma hdrstop
#pragma argsused
|
by: David Mathog |
last post by:
One thing that can make porting C code from one
platform to another miserable is #include. In particular,
the need to either place the path to an included file within
the #include statement or to very carefully define the
order in which paths are searched with command line options
on the compiler. Both can cause problems, especially when
dealing with complex software distributions.
It occurs ot me that by extending the C include...
|
by: Arpi Jakab |
last post by:
I have a main project that depends on projects A and B. The main project's
additional include directories list is:
...\ProjectA\Dist\Include
...\ProjectB\Dist\Include
Each of the include directories contain a file named "cppfile1.h".
In my main project I #include "cppfile1.h". I rely on the order of paths in
additional include directories list to get file cppfile1.h from ProjectA and
|
by: tshad |
last post by:
In my User control, I tried to do this:
***************************************************************************
<Script runat="server">
Public ClientName As String = "<!-- #include file =
...\includes\StaffingHeaders.inc -->"
</Script>
<%=ClientName%>
****************************************************************************
|
by: yanksrock528 |
last post by:
I am writing a program, and i would like to save an xml file that is on the internet now, to my computer in this csharp program. Something else that might help is if i could get the csharp xml reader to work on files on the internet. I would like to read the attributes of xml files and for some reason that is only working when i read the files on my local drive. I am fairly new to csharp and all that i know i have tought myself through the...
| |
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,...
|
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,...
|
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...
|
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...
|
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();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |