This is what I used to do when I worked with asp.net
Note that I remember that this could work also with app.config but it's been sometimes so I'm not saying this with 100% certainty.
Also note that I'm not sure that you can decrypt on another server machine like that, so you might also want to read this:
https://docs.microsoft.com/en-us/pre...ectedfrom=MSDN
https://social.msdn.microsoft.com/Fo...csharplanguage