473,809 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Nasty connection String error / encoding.ascii. getstring error

I am creating an connection string at runtime using decryption (crypto
libraries).

i have a very unpridictable error while assinging the generated
connection string to the connection property.

my code is something like this ...

Public Function DbconnStr(ByVal UID As String, ByVal Pwd As String, _
ByVal ServerName As String,
ByVal DbName As String) As StringBuilder

Dim str as stringbuilder
Dim UIDinfo As String =
Convert.ToBase6 4String(Decrypt Data.Decrypt(En coding.ASCII.Ge tBytes(UID)))
Dim PWDinfo As String =
Convert.ToBase6 4String(Decrypt Data.Decrypt(En coding.ASCII.Ge tBytes(Pwd)))

Str.Append("Ser ver=")
Str.Append(Serv erName)
Str.Append(";Da tabase=")
Str.Append(DbNa me)
Str.Append(";Us er ID=")
Str.Append(UIDi nfo)
Str.Append(";pa ssword=")
Str.Append(PWDi nfo)
Str.Append(";Tr usted_Connectio n=False")

Catch ex As Exception
Throw New Exception("In WASC " & ex.Message)
End Try
Return Str
End Function
the generated string ... something like
--"Server=GVA2194 3\SQLSERVER;Dat abase=Northwind ;User

ID=WASCuser;pas sword=welcome;T rusted_Connecti on=False"

the error is ---Format of the initialization string does not conform
to specification starting at index 61. -- which is always the end of

user ID.

If i hard code the same value i am thru the connection.
Also i noticed an additional char when i find the length of the string
generated for UIDinfo and PWDinfo.
so when i delete the last character generated ... again the connection
is thru at runtime.
But without deleting when i print the connectstring ... i don't find
that character ...its invisible....

pls help me to know y that invisible character (at the end of the
generated string for UIDinfo and PWDinfo) giving me this nasty error.

thanks.
Nov 20 '05 #1
1 4885
James,
What is DecryptData.Dec rypt?
pls help me to know y that invisible character (at the end of the
generated string for UIDinfo and PWDinfo) giving me this nasty error.
Are you comfortable that DecryptData.Dec rypt or Convert.ToBase6 4String are
not including a trailing character on the end of the string that is being
returned?

Such as a trailing null char (ChrW(0)) or something?

Or even your input string itself.

Hope this helps
Jay

"james" <ja*******@yaho o.com> wrote in message
news:35******** *************** ***@posting.goo gle.com... I am creating an connection string at runtime using decryption (crypto
libraries).

i have a very unpridictable error while assinging the generated
connection string to the connection property.

my code is something like this ...

Public Function DbconnStr(ByVal UID As String, ByVal Pwd As String, _
ByVal ServerName As String,
ByVal DbName As String) As StringBuilder

Dim str as stringbuilder
Dim UIDinfo As String =
Convert.ToBase6 4String(Decrypt Data.Decrypt(En coding.ASCII.Ge tBytes(UID)))
Dim PWDinfo As String =
Convert.ToBase6 4String(Decrypt Data.Decrypt(En coding.ASCII.Ge tBytes(Pwd)))

Str.Append("Ser ver=")
Str.Append(Serv erName)
Str.Append(";Da tabase=")
Str.Append(DbNa me)
Str.Append(";Us er ID=")
Str.Append(UIDi nfo)
Str.Append(";pa ssword=")
Str.Append(PWDi nfo)
Str.Append(";Tr usted_Connectio n=False")

Catch ex As Exception
Throw New Exception("In WASC " & ex.Message)
End Try
Return Str
End Function
the generated string ... something like
--"Server=GVA2194 3\SQLSERVER;Dat abase=Northwind ;User

ID=WASCuser;pas sword=welcome;T rusted_Connecti on=False"

the error is ---Format of the initialization string does not conform
to specification starting at index 61. -- which is always the end of

user ID.

If i hard code the same value i am thru the connection.
Also i noticed an additional char when i find the length of the string
generated for UIDinfo and PWDinfo.
so when i delete the last character generated ... again the connection
is thru at runtime.
But without deleting when i print the connectstring ... i don't find
that character ...its invisible....

pls help me to know y that invisible character (at the end of the
generated string for UIDinfo and PWDinfo) giving me this nasty error.

thanks.

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
13544
by: wkodie | last post by:
I'm having trouble encrypting/decrypting a simple string using the System.Security.Cryptography.TripleDESCryptoServiceProvider, etc... The encryption works, but the decryption does not properly decrypt several of the first few characters. Here's the code: class TMyCipher {
2
4685
by: Gary Short | last post by:
Hello group, I was wondering if anyone here could help me with an odd WebClient problem. When I run the following code: WebClient aWebClient = new WebClient(); Byte aBA = aWebClient.DownloadData("http://www.microsoft.com"); string strContent = Encoding.ASCII.GetString(aBA); Everything works as expected. However, when I run the following code:
4
7594
by: Brian Rice | last post by:
I have a socket application that is sending and receiving packets asynchronously. It works great except, when I receive packets that are larger than my receive buffer which then generate several EndReceive calls... these calls seem to be sometimes coming out of order. For example, the following is from my log file: Connection at 5/1/2004 11:39:14 AM SENT> ZZZ:1:FMZZZ:ID1234:PWAAAA:VR100:\0 RCVD>...
2
1363
by: kscdavefl | last post by:
I am using the following code to populate a texst box: private string convertstring(string getLD) { Byte myBytes13 = {13}; string myStr13 = System.Text.Encoding.ASCII.GetString(myBytes13); Byte myBytes10 = {10}; string myStr10 = System.Text.Encoding.ASCII.GetString(myBytes10);
8
5236
by: KRoy | last post by:
I have a password stored in the Registry encrypted using System.Security.Cryptography DES Algorithm. I supplied it a password and a Initialization Vector. I am trying to decrypt it using the CryptoAPI in VB6. I am using the CryptDeriveKey to generate a session key from a password. But it is not working and I am sure the password is correct. In .net I supplied an IV, when and how do I do that using
1
4033
by: Terrance | last post by:
I'm trying to create a small messenger program that uses the tcpclient and tcplistenter objects. When I start the application and run the thread that fires the tcplistener; once the client sends data then closes the stream and the connection I receive the message Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. How can I keep the connection listener listening for new traffic?...
3
6775
by: Sir Psycho | last post by:
Hi, For some reason, when i step over this code, it returns the full byte stream im expecting from the server, however when I let it run with no intervention, it only seems to grab a small chunk on the stream. What am I doing wrong? There is more code than this, but this is the problem code.
0
1025
by: id10t error | last post by:
Hello, I am trying to write soem code that will send data to an Oneil printer over our network. I know the printer works and is setup correctly because I can print to it from there software. In my program i am getting this error. System.IO.IOException was unhandled Message="Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."
13
17636
by: Eps | last post by:
Hi there, I believe all strings in .net are unicode by default, I am looking for a way to remove all non ascii characters from a string (or optionally replace them). There is an article on code project which kind of looks like it does what I want but I can't help thinking it makes it more complex than it needs to be.
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10639
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10120
tracyyun
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...
0
9200
agi2029
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...
1
7661
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
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();...
0
5550
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...
1
4332
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 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.