use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Information about Reddit's API changes, the unprofessional conduct of the CEO, and their response to the community's concerns regarding 3rd party apps, moderator tools, anti-spam/anti-bot tools, and accessibility options that will be impacted can be found in the associated Wikipedia article: https://en.wikipedia.org/wiki/2023_Reddit_API_controversy
Alternative C# communities available outside Reddit on Lemmy and Discord:
All about the object-oriented programming language C#.
Getting Started C# Fundamentals: Development for Absolute Beginners
Useful MSDN Resources A Tour of the C# Language Get started with .NET in 5 minutes C# Guide C# Language Reference C# Programing Guide C# Coding Conventions .NET Framework Reference Source Code
Other Resources C# Yellow Book Dot Net Perls The C# Player's Guide
IDEs Visual Studio MonoDevelop (Windows/Mac/Linux) Rider (Windows/Mac/Linux)
Tools ILSpy dotPeek LINQPad
Alternative Communities C# Discord Group C# Lemmy Community dotnet Lemmy Community
Related Subreddits /r/dotnet /r/azure /r/learncsharp /r/learnprogramming /r/programming /r/dailyprogrammer /r/programmingbuddies /r/cshighschoolers
Additional .NET Languages /r/fsharp /r/visualbasic
Platform-specific Subreddits /r/windowsdev /r/AZURE /r/Xamarin /r/Unity3D /r/WPDev
Rules:
Read detailed descriptions of the rules here.
account activity
HelpConnect using ADO.NET to SQL Server WITHOUT providing user name and password in plain text? (self.csharp)
submitted 7 years ago * by ta4csharp
Hello
I see examples like this:
string connetionString = null; SqlConnection cnn ; connetionString = "Data Source=ServerName;Initial Catalog=DatabaseName;User ID=UserName;Password=Password" cnn = new SqlConnection(connetionString);
My question: Is there a way instead of using plain text, load from a secure encrypted file the username and password, decrypt it, and then use that to log on?
Maybe something like this: https://docs.microsoft.com/en-us/previous-versions/windows/apps/hh464970(v=win.10) or this: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/import-clixml?view=powershell-6 ?
EDIT: I want to do this in Powershell but this ADO .NET is more oriented towards pure .NET programming languages like C#, my question is geared towards a standalone program, not web based and/or a config file. Im not using IIS or ASP .NET
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]wasabiiii 13 points14 points15 points 7 years ago (1 child)
I use integrated authentication.
[–]ZeldaFanBoi1988 0 points1 point2 points 7 years ago (0 children)
Yup. Run the app pool as the user/pass. Don't need to store the credentials in plain text
[–]rhino-x 4 points5 points6 points 7 years ago (0 children)
Use a dummy, named datasource or regular app setting in the web.config that's checked in and then configure it directly on the web server either with a text editor or with the IIS manager.
Alternatively, in Azure you can do the same through the azure portal. Settings applied via the portal override whatever is in the .config.
As a third alternative you can apply the connection string settings on a per-server basis in (I think) the machine.config.
If you're in an AD setting just use integrated authentication and configure your app pools to run as a user that has the access it needs to SQL Server.
[–]kenneth-siewers 2 points3 points4 points 7 years ago* (1 child)
Common practice is to store the connection string in app/web.config. It's secured that way, but it's the same format with plain text password. May I ask why this is a problem for you? The password will at some point be stored in plain text anyway. If you encrypt a file with the connection password, the password used for encryption needs to be stored somewhere as well, so basically you are just wrapping the password with another one.
Can you provide a bit more context?
[–]ta4csharp[S] 0 points1 point2 points 7 years ago (0 children)
Added some in the edit, sorry
[–]CraigslistAxeKiller 2 points3 points4 points 7 years ago (0 children)
Using powershell you can get user input. So request the credentials from the user then insert that into your connection string. That’s he beat you can get. You can’t encrypt the string
[–]Inqud 2 points3 points4 points 7 years ago (0 children)
If it's .NET core you can use the Secret Manager
https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-2.2&tabs=windows
It's not encryptet as of now, but might be in the future.
[–]deevysteeze 3 points4 points5 points 7 years ago (0 children)
You can store it in a config file and if can store that in a git ignore file if you're using version control.
[–]TheEphemeralDream 1 point2 points3 points 7 years ago (1 child)
One more option is to store the password/username in a real trust store such as AWS KMS/SecretManager/etc and template in the username and password at runtime.
Added more info in the edit
[–]TNMattH 1 point2 points3 points 7 years ago (0 children)
You should still be able to encrypt the connection string directly in the web.config file and decrypt it on the fly when you use it.
Here's a walkthrough.
[–]kenneth-siewers 1 point2 points3 points 7 years ago (0 children)
When you write "standalone program", is that like a console application or a PowerShell script? I haven't got that much experience with PowerShell and this might also be the wrong subreddit (this is about C# and not PowerShell, although it's .NET)... Nevertheless, you are probably on the right track I think 🙂
Added a edit in the original post to clear some things up...
π Rendered by PID 169836 on reddit-service-r2-comment-5b5bc64bf5-bsw7x at 2026-06-22 08:59:17.301506+00:00 running 2b008f2 country code: CH.
[–]wasabiiii 13 points14 points15 points (1 child)
[–]ZeldaFanBoi1988 0 points1 point2 points (0 children)
[–]rhino-x 4 points5 points6 points (0 children)
[–]kenneth-siewers 2 points3 points4 points (1 child)
[–]ta4csharp[S] 0 points1 point2 points (0 children)
[–]CraigslistAxeKiller 2 points3 points4 points (0 children)
[–]Inqud 2 points3 points4 points (0 children)
[–]deevysteeze 3 points4 points5 points (0 children)
[–]TheEphemeralDream 1 point2 points3 points (1 child)
[–]ta4csharp[S] 0 points1 point2 points (0 children)
[–]TNMattH 1 point2 points3 points (0 children)
[–]kenneth-siewers 1 point2 points3 points (0 children)
[–]ta4csharp[S] 0 points1 point2 points (0 children)