Connection string encryption in VB.Net

After hours of tests I’ve succeeded in ConnectionString encryption in I’m not sure if code will work because I’ve done encryption in my test local website. What more, I’ve made websites for fun to learn something new.

Attention! This post has been published on my old website that has been down. I’m archiving old not verified posts for possible future use. Please be careful when using this post content.

The issue is I’ve run code on localhost – I hasn’t been checked on external server. I don’t know how the encryption works with MySQL located in external server, how the encryption key is storage, where etc.?

My encryption websites source:

Thanks to this code following actions will be done:

  • Adding Connection String to file Web.config
  • Adding encryption code of Connection String
  • Connection String will be encrypted
  • We connect MySQL database
  • Records from MySQL will be selected and added to GridView

In my test I’ve added event button to page to encrypt or decrypt ConnectionString. First ConnectionString has to be added to Web.config file between <configuration> and </configuration>

Adding Connection String to Web.config file:

   <add name="MySql" connectionString="Data Source=Localhost; Database=tornado; Uid=User; Pwd=Pass;"  providerName="MySql.Data.MySqlClient" />

ConnectionString has to be named. In my project it was MySql because I’m connecting MySQL database. Also ProviderName has to be added this is MySql.Data.MySqlClient related to Imports MySql.Data.MySqlClient.

Button encryption code (sorry – but I’m not sure of this code):

Imports System.Configuration
Imports System.Web.Configuration 

Shared Sub ToggleWebEncrypt()

   ' Open the Web.config file.
   Dim config As Configuration = WebConfigurationManager. _

   ' Get the connectionStrings section.
   Dim section As ConnectionStringsSection = DirectCast( _
       config.GetSection("connectionStrings"), _
   ' Toggle encryption.
   If section.SectionInformation.IsProtected Then
       section.SectionInformation.ProtectSection( _
   End If 

   ' Save changes to the Web.config file.
End Sub

Encrypted Web.config file view:

<connectionStrings configProtectionProvider="DataProtectionConfigurationProvider">

MySQL test connection and GridView fill:

Imports MySql.Data.MySqlClient
Imports System.Data
Imports System.Configuration
Imports System.Web.Configuration

   Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click 

       Dim dt As New DataTable

       ' Open the Web.config file.
       Dim config As Configuration = WebConfigurationManager. _

       ' Get the connectionStrings section.
       Dim section As ConnectionStringsSection = DirectCast( _
           config.GetSection("connectionStrings"), _

       ' Toggle encryption.
       If section.SectionInformation.IsProtected Then

           Dim conn As MySqlConnection = New MySqlConnection() ' forgot source

           conn.ConnectionString = ConfigurationManager.ConnectionStrings("MySql").ConnectionString 


               Dim adapter As MySqlDataAdapter = New MySqlDataAdapter("SELECT * FROM tornadolokacje", conn)

               GridView1.DataSource = dt

           Catch ex As Exception
           End Try
           MsgBox("Conneection String decryption problem.")
       End If
   End Sub

487 thoughts on “Connection string encryption in VB.Net

  1. Pingback: Power to Choose Alternative

  2. Pingback: buy/order real oxycodone 80mg 30mg 15mg online pharmacy cheap no script legally for pain, anxiety in USA UK Canada Australia overseas overnight delivery

  3. Pingback: money wealth

  4. Pingback: hydromorphone for sale online overnight shipping

  5. Pingback: order real adipex 37.5mg tablets for sale next day shipping pharmacy

  6. Pingback: cach chon keo bong da

  7. Pingback: danh de online uy tin

  8. Pingback: Buy 2C-B Research chemical powder Online for sale near me in USA Canada UK Australia overnight delivery cheap

  9. Pingback:

  10. Pingback: ti le chap bong da

  11. Pingback: cách bắt đề kép

  12. Pingback: mơ thấy rắn đánh đề gì

  13. Pingback: game bai poker doi thuong

  14. Pingback: UNICCSHOP.BAZAR

  15. Pingback: replica watches

  16. Thanks for your article on the traveling industry. I might also like to add that if you’re a senior considering traveling, it truly is absolutely important to buy travel cover for retirees. When traveling, older persons are at greatest risk of experiencing a health care emergency. Obtaining right insurance coverage package for the age group can look after your health and provide you with peace of mind.
    dang ky 188bet

  17. Pingback: pinewswire

  18. Pingback: 홀덤사이트

  19. Pingback: concerta 18 mg pills for sale overnight delivery cheap

  20. Pingback: vicodine pills for sale usa

  21. Pingback: blazing trader review

  22. Pingback: frontier airlines Phone Number

  23. Pingback: bitcoin evolution review

  24. Pingback: River poker

  25. Pingback: w88 lite

  26. Pingback: mơ thấy ao nước đánh con gì

  27. Pingback: w88club

  28. Pingback: nằm mơ thấy con rết là điềm gì

  29. Pingback: mơ thấy ba ba

  30. Pingback: mơ mình chết đánh con gì

  31. Pingback: Pomeranian breeders

  32. Pingback: 홀덤사이트

  33. Pingback:

  34. Pingback: mơ thấy người cha đã mất

  35. Pingback: Smith and Wesson guns in stock

  36. Pingback:

  37. Pingback: masterdomino99

  38. Pingback: ตู้แปลภาษา

  39. Pingback: mo thay vang

  40. Pingback: 먹튀검증업체

  41. Pingback: silicone sex dolls for sale

  42. Pingback: buy cialis canada

  43. Pingback: buy levitra from india

  44. Pingback: cialis ordering

  45. Pingback: pfizer viagra buy

  46. Pingback: cialis mail order pharmacy

  47. Pingback: cialis mail order australia

  48. Pingback: buy cialis online best price

  49. Pingback: order original cialis online

  50. Pingback: cialis 5mg tablet

  51. Pingback: where can u buy cialis

  52. Pingback: cialis sale 20mg

  53. Pingback: buy cialis toronto

  54. Pingback: buy cialis online viagra

  55. Pingback: ppirdtgn

  56. Pingback: where can i buy cialis online safely

  57. Pingback: hoe lang is viagra werkzaam

  58. Pingback: azithromycin chlamydia how long does it take to cure

  59. Pingback: buying cheap cialis online

  60. Pingback: viagra cheap

  61. Pingback: canadian pharmacy cialis 20mg

  62. Pingback: cialis for daily use

  63. Pingback: viagra precio

  64. Pingback: how to buy cialis online from canada

  65. Pingback: reddit essay writing service

  66. Pingback: how to write a thesis for a research paper

  67. Pingback: where can i pay someone to write my essay

  68. Pingback: essay on the help

  69. Pingback: business ethics illinoi shadow process essay

  70. Pingback: canadian pharmacy cialis 20mg

  71. Pingback: cialis online daily

  72. Pingback: canadian pharmacy cialis 20mg

  73. Pingback: where to buy amoxicillin 500mg

  74. Pingback: lasix furosemide

  75. Pingback: zithromax pak

  76. Pingback: stromectol tablets for humans for sale

  77. Pingback: ventolin over the counter

  78. Pingback: buy viagra online

  79. Pingback: cheap viagra

  80. Pingback: coupons for viagra

  81. Pingback: viagra falls

  82. Pingback: cialis online pharmacy

  83. Pingback: viagra and alcohol

  84. Pingback: viagra prices

  85. Pingback: snorting viagra

  86. Pingback: viagra single packs

  87. Pingback: cialis copay card

  88. Pingback: buy doxycycline 100mg

  89. Pingback: prednisolone with benadryl

  90. Pingback: cialis coupon

  91. Pingback: clomid hot flashes

  92. Pingback: viagra gay sex

  93. Pingback: viagra boner

  94. Pingback: dapoxetine in bangladesh

  95. Pingback: 150 mg viagra

  96. Pingback: viagra alternative

  97. Pingback: otc diflucan walgreens

  98. Pingback: sildenafil 100mg price

  99. Pingback: levitra

  100. Pingback: synthroid action

  101. Pingback: viagra sex

  102. Pingback: sophia viagra nude

  103. Pingback: propecia online pharmacy

  104. Pingback: viagra expiration potency

  105. Pingback: mom gave viagra by accident

  106. Pingback: revenue per year viagra 2022

  107. Pingback: does 60mg sildenafil help erections

  108. Pingback: dosage for cialis

  109. Pingback: accidentally took viagra mom help

  110. Pingback: viagra from india info

  111. Pingback: sildenafil is made from what

  112. Pingback: viagra cum milking

  113. Pingback: can i use viagra

  114. Pingback: dog ate viagra south africa

  115. Pingback: neurontin strengths

  116. Pingback: sildenafil generic 50 mg

  117. Pingback: cialis dosage reddit australia

  118. Pingback: cialis purchase online usa

  119. Pingback: metformin liver

  120. Pingback: best price for sildenafil

  121. Pingback: cialis ingredients australia

  122. Pingback: paxil for fibromyalgia

  123. Pingback: plaquenil tinnitus

  124. Pingback: amoxicillin dosage sinus infection

  125. Pingback: dosage amoxicillin

  126. Pingback: azithromycin classification

  127. Pingback: how long for celebrex to work

  128. Pingback: celebrex 200mg price

  129. Pingback: does cephalexin affect inr

  130. Pingback: keflex generic name

  131. Pingback: side eddects duloxetine

  132. Pingback: cymbalta and elavil

  133. Pingback: cheap viagra 100mg canada

  134. Pingback: order viagra 50mg

  135. Pingback: order cialis generic online

  136. Pingback: cialis

  137. Pingback: real cialis for sale

  138. Pingback: viagra india price

  139. Pingback: acheter viagra 200

  140. Pingback: viagra generic name south africa

  141. Pingback: cialis expiration period

  142. Pingback: cheap cialis pills australia

  143. Pingback: metformin 1g

  144. Pingback: comprar sildenafilo 100 mg teva

  145. Pingback: sildenafil best price uk

  146. Pingback: viagra online purchase india

  147. Pingback: finasteride medication

  148. Pingback: buying sildenafil 100mg

  149. Pingback: acheter viagra pfizer 100mg

  150. Pingback: wo buy cheap generic viagra

  151. Pingback: snorting cialis australia

  152. Pingback: cheap propecia generic

  153. Pingback: how to order cialis from india

  154. Pingback: sildenafil online canada

  155. Pingback: 100 viagra pills australia

  156. Pingback: viagra 50 coupon

  157. Pingback: sildenafilo india comprar

  158. Pingback: sildenafil troche dosage

  159. Pingback: buy generic cialis canadian pharmacy

  160. Pingback: viagra 100mg price canada

  161. Pingback: buy cialis 36 hour online

  162. Pingback: impotence pills

  163. Pingback: pills for ed

  164. Pingback: medication canadian pharmacy

  165. Pingback: cialis 20mg for sale

  166. Pingback: costco online pharmacy

  167. Pingback: buy cialis ebay

  168. Pingback: buy cialis tadalafil uk

  169. Pingback: generic cialis daily pricing

  170. Pingback: buy online generic

  171. Pingback: no prescription tretinion gel

  172. Pingback: how to delete tinder account

  173. Pingback: cash in advance hendersonville

  174. Pingback: what is the active ingredient in viagra

  175. Pingback: lisinopril brand name cost

  176. Pingback: buy shipping canada

  177. Pingback: free dating sites for soldiers

  178. Pingback: zestoretic tabs

  179. Pingback: when will there be generic cialis

  180. Pingback: brand levitra cialis viagra add to cart

  181. Pingback: cialis pris

  182. Pingback: generic cialis canadian

  183. Pingback: canadian overnight pharmacy review

  184. Pingback: tadalafil vs cialis reviews

  185. Pingback: buy cialis in miami

  186. Pingback: online pharmacy without a prescription

  187. Pingback: pharmacy tech practice tests online

  188. Pingback: 30 day free cialis

  189. Pingback: buy cialis without perscription

  190. Pingback: buy cheap cialis overnight

  191. Pingback: how to buy cialis online from canada

  192. Pingback: prescription without a doctor's prescription

  193. Pingback: generic tadalafil tablets

  194. Pingback: where can i buy valtrex

  195. Pingback: viagra meaning

  196. Pingback: Google

  197. Pingback: what is the best ed pill

  198. Pingback: buy cialis wholesale

  199. Pingback: viagra prank

  200. Pingback: cialis pharmacy australia

  201. Pingback: sildenafil recall

  202. Pingback: cheap online pharmacy

  203. Pingback: what cialis does

  204. Pingback: sildenafil 200mg price

  205. Pingback: batman pinball machine

  206. Pingback: buying viagra online

  207. Pingback: Weed Wax

  208. Pingback: PARROTS FOR SALE

  209. Pingback: software review

  210. Pingback: FLOUR MILL

  211. Pingback: buying cialis online

  212. Pingback: viagra generic cost

  213. Pingback: kratom capsules

  214. Pingback: best kratom

  215. Pingback: buy Instagram likes

  216. Pingback: best delta 8 thc gummies

  217. Pingback: sex toys for large girls

  218. Pingback: tides today at

  219. Pingback: diclofenac natrium

  220. Pingback: Central License For Export

  221. Pingback: ed supplements

  222. Pingback: cheap pet meds without vet prescription

  223. Pingback: THC Gummies

  224. Pingback: delta 8 THC

  225. Pingback: buy weed near me

  226. Pingback: where to buy ivermectin pills

  227. Pingback: stromectol cream

  228. Pingback: free rich men dating on pof

  229. Pingback: plaquenil 100 mg tablets

  230. Pingback: best male masturbator

  231. Pingback: pocket vibrator

  232. Pingback: how much is generic plaquenil

  233. Pingback: Juneau Empire

  234. Pingback: buy weed online

  235. Pingback: how to buy weed online

  236. Pingback: tiktok followers

  237. Pingback: buy guns online

  238. Pingback: dangers of priligy

  239. Pingback: white mousse concentrates

  240. Pingback: cost of ivermectin cream

  241. Pingback: Komunitas obligasi

  242. Pingback: walmart price for albuterol inhaler

  243. Pingback: ivermectin 12 mg

  244. Pingback: MUT

  245. Pingback: will trump take hydroxychloroquine

  246. Pingback: cialis without a doctor's prescription

  247. Pingback: istanbul escort

  248. Pingback: prescription drugs without prior prescription

  249. Pingback: Parksville Roofers

  250. Pingback: boho coffee table

  251. Pingback: Red Eyed Crocodile Skink

  252. Pingback: does hydroxychloroquine affect kidneys

  253. Pingback: kci 100 round drum for sale

  254. Pingback: buy generic 100mg viagra online

  255. Pingback: п»їviagra pills

  256. Pingback: how to lose belly fat naturally

  257. Pingback: buy cialis online overnight

  258. Pingback: hydroxychloroquine overdose human

  259. Pingback: buy cialis 36 hour

  260. Pingback: adam and eve

  261. Pingback: Canadian service

  262. Pingback: HBCUEX

  263. Pingback: order juul pods

  264. Pingback: معرفة هوية المتصل

  265. Pingback: buy cannabis online usa

  266. Pingback: Buy Ruger Online

  267. Pingback: plaquenil generic

  268. Pingback: cheap cialis dapoxitine cheap online

  269. Pingback: best place to buy generic cialis

  270. Pingback: hydroxychloroquine for rheumatoid arthritis

  271. Pingback: pocket masturbator

  272. Pingback: penis sleeve extension

  273. Pingback: is viagra bad for you

  274. Pingback: cialis para que sirve

  275. Pingback: online viagra sales

  276. Pingback: getting prescription drugs from canada

  277. Pingback: keto trim reviews

  278. Pingback: can you buy zithromax over the counter in mexico

  279. Pingback: watch tour de pharmacy online

  280. Pingback: what is the difference between viagra and cialis

  281. Pingback: where to get zithromax

  282. Pingback: tourism

  283. Pingback: how to get zithromax

  284. Pingback: best wand massager

  285. Pingback: male masturbator review

  286. Pingback: International Hospital Management

  287. Pingback:

  288. Pingback: bostanci escort

  289. Pingback: how much is a viagra pill

  290. Pingback: weighted kegel balls

  291. Pingback: how good does ivermectil work

  292. Pingback: sexual wellness

  293. Pingback: average cost of prescription drugs

  294. Pingback: best p spot massager

  295. Pingback: cost of ivermectin medicine

  296. Pingback: erection pills viagra online

  297. Pingback: ed drugs list

  298. Pingback: plaquenil nz

  299. Pingback: where can I buy weed

  300. Pingback: fun88

  301. Pingback: best remote control panties

  302. Pingback: male stroker toy

  303. Pingback: best p spot massager

  304. Pingback: Male Masturbator Reviews

  305. Pingback: hosting deals

  306. Pingback: MILF Porn

  307. Pingback: cialis dosage

  308. Pingback: ground leases

  309. Pingback: ivermectin price canada

  310. Pingback: lotto vip

  311. Pingback: fda approved drug priligy

  312. Pingback: ruay vip

  313. Pingback: p spot toys

  314. Pingback: vibrating stroker

  315. Pingback: best realistic dildos

  316. Pingback: dildo and balls

  317. Pingback: كشف هوية المتصل

  318. Pingback: Dank Cartridges

  319. Pingback: cryptocurrency 99defi

  320. Pingback: etiler escort

  321. Pingback: lisinopril hydrochlorothiazide 20 25 mg

  322. Pingback: site de streaming

  323. Pingback: reliable car transport

  324. Pingback: french streaming

  325. Pingback: streaming gratuit

  326. Pingback: how long does it take for amlodipine to get out of your system

  327. Pingback: sites para ver futebol

  328. Pingback: - Trade now

  329. Pingback: website

  330. Pingback: alternatives to atorvastatin

  331. Pingback: realistic pocket stroker

  332. Pingback: omeprazole magnesium side effects

  333. Pingback: sex toys for male masturbation

  334. Pingback: vibrating penis ring

  335. Pingback: best bullet vibrator

  336. Pingback: 1xbit

  337. Pingback: quetiapine fumarate 25mg tab

  338. Pingback: male pocket stroker

  339. Pingback: zoloft sexual side effects

  340. Pingback: hydroxychloroquine 875

  341. Pingback: best in ottawa

  342. Pingback: fr agnel school noida

  343. Pingback: how long does it take lyrica to work

  344. Pingback: pills from canada

  345. Pingback: cheap ed pills from canada

  346. Pingback: herbal viagra

  347. Pingback: ruger 10 22 carbine for sale

  348. Pingback: 안전사이트

  349. Pingback:

  350. Pingback: duloxetine generic 60 mg identification

  351. Pingback: sildenafil 50 mg

  352. Pingback: atorvastatin and fenofibrate

  353. Pingback: russian books

  354. Pingback: purchase viagra online

  355. Pingback: generic viagra 100mg

  356. Pingback: 2 Day Murchison Falls Safari

  357. Pingback: viagra online canadian pharmacy

  358. Pingback: always

  359. Pingback: Kingpen

  360. Pingback: deltasone rayos tablet

  361. Pingback: stromectol for kidney infection

  362. Pingback: discount cialis online

  363. Pingback: escitalopram 5mg tablets side effects

  364. Pingback: cialis tablet

  365. Pingback: apple jack big cheif

  366. Pingback: cialis pills

  367. Pingback: how to order cialis

  368. Pingback: cockatoo for sale near

  369. Pingback: cialis 5

  370. Pingback: tadalafil cialis 5mg

  371. Pingback: KETASET FOR SALE

  372. Pingback: West Highland White Terrier puppy for sale

  373. Pingback: cheap generic cialis canada

  374. Pingback: female viagra

  375. Pingback: Bradfield School

  376. Pingback: canadian pharmacies

  377. Pingback: blowjob simulator

  378. Pingback: buy viagra rome

  379. Pingback: vibrating dildo

  380. Pingback: natural viagra

  381. Pingback: aranżacja wnętrz Gdynia

  382. Pingback: بديل تروكولر

  383. Pingback: viagra prescription online

  384. Pingback: cymbalta nausea relief

  385. Pingback: pc games for windows 10

  386. Pingback: free download for pc

  387. Pingback: free download for windows 8

  388. Pingback: buy cialis soft tabs

  389. Pingback: free download for windows 7

  390. Pingback: free full download for windows

  391. Pingback: buy cialis pills

  392. Pingback: free download for windows pc

  393. Pingback: teva stromectol 6mg

  394. Pingback: 1

  395. Pingback: apk for pc download

  396. Pingback: mp3

  397. Pingback: military gay dating site

  398. Pingback: viagra online canada

  399. Pingback: THC Vape Oil

  400. Pingback: 25 mg viagra cost

  401. Pingback: Animation reseaux sociaux

  402. Pingback: Computer Repair Bridgewater

  403. Pingback: Sig Sauer Guns For Sale

  404. Pingback: where to get female viagra pills

  405. Pingback: amoxicillin cough

  406. Pingback: tadalafil 40 mg

  407. Pingback: cheap viagra online

  408. Pingback: Pinball Machines for Sale

  409. Pingback: Macbook pro akku ersetzen pfäffikon

  410. Pingback: Kenya masai Mara best time to visit

  411. Pingback: Livestock for sale

  412. Pingback: cost of viagra

  413. Pingback: Mac akku tausch zürich

  414. Pingback: online pharmacy cialis

  415. Pingback: bujagali falls white water rafting

  416. Pingback: 50mg prednisone tablet

  417. Pingback: best sex toys


  419. Pingback: shipping containers for sale

  420. Pingback: buy sildenafil

  421. Pingback: ارقام بنات

  422. Pingback: Serengeti safari

  423. Pingback: aromatherapy for anxiety

  424. Pingback: cialis 5mg online

  425. Pingback: ivermectin 3 mg tab

  426. Pingback: cheap viagra online canadian pharmacy

  427. Pingback: how to purchase viagra online in india

  428. Pingback: cialis 10mg online

  429. Pingback: ivermectin mexico tablets

  430. Pingback: viagra canadian pharmacy

  431. Pingback: ivermectay 6 uses

  432. Pingback: website

  433. Pingback: loweslife

  434. Pingback: ivermectin for scabies in humans

  435. Pingback: cost of zithramax z-pak

  436. Pingback: ivermectin mange treatment dosage

  437. Pingback: ivermectin mechanism

  438. Pingback: viagra tablet online india

  439. Pingback: order ventolin online canada

  440. Pingback: Buy Ketamine online

  441. Pingback: ivermectin pharmacy

  442. Pingback: ivermectin side effects dogs

  443. Pingback: VANILLA BEAN STRAIN

  444. Pingback: ivermectin stock market

  445. Pingback: "buy viagra"

  446. Pingback: savage 110 tactical

  447. Pingback: colt 45 cattleman revolver

  448. Pingback: buy viagra in england

  449. Pingback: sig sauer emperor scorpion

  450. Pingback: taurus pt92 for sale

  451. Pingback: deckmate shuffler

  452. Pingback: mossberg mvp patrol

  453. Pingback: where to buy stiiizy battery

  454. Pingback: buy sodium pentobarbital

  455. Pingback: cialis with daxopretine

  456. Pingback: magic mushrooms

  457. Pingback: cialis superactive

  458. Pingback: zithromax online from india

  459. Pingback: generic cialis

  460. Pingback: why does the military buy viagra

  461. Pingback: viagra pills

  462. Pingback: grape pie strain exotic carts

  463. Pingback: background check service

  464. Pingback: best generic viagra online

  465. Pingback: buy sildenafil online

  466. Pingback: lisinopril interaction with other drugs

  467. Pingback: juul mango pods

  468. Pingback: armadillo lizard for sale

  469. Pingback: beretta 92fs compact for sale

  470. Pingback: smith and wesson arms

  471. Pingback: ewin chairs

  472. Pingback: womens viagra

  473. Pingback: why is dapoxetine so expensive

  474. Pingback: discreet weed shop in Miami

  475. Pingback: buy levitra from canada

  476. Pingback: ethereum mining machine for sale in europe

  477. Pingback: Baby Fennec Fox for Sale

  478. Pingback: can you buy levitra from canada

  479. Pingback: Murchison falls

  480. Pingback: scan 3xs 3080 gaming pc

  481. Pingback: used concept 2 rower

  482. Pingback: Vertise

Leave a Reply

Your email address will not be published. Required fields are marked *