VB.NET My database connection is always hacked - sql-server

I am using VB.NET 2015 with SQL Server connection for my application with a login system, I protect my assembly with .NET Reactor and everytime I publish my project protected I find that my connection string is published, I tried to encrypt my connection string inside the code and didn't work although I tried too different protections and results were the same, Everytime my connection string gets published and all tables gets dropped, I am tired of that, Is there another way of how can I protect my database connection? And what's the wrong in my database connection?
Thanks in advance.

Related

DNN Error - Can't Connect To Database

I know this question has been asked many times, but none of the symptoms seem to match my problem and thus none of the solutions work.
I am in the process of moving a DNN site (v. 7.04) from our company's IT infrastructure to an externally hosted VM as they were unable to give guaranteed up time. (The last straw was when their DNS server fell over Friday afternoon and we couldn't even contact anyone until Monday morning. Still took them two more days to fix it, but I digress...)
I'm administering the VM so I have full access to it and the software running on it. I do not have access to the server on which the website and database are currently running.
I have copied the website files from the old server to the new and have been provided with database backups which I have successfully restored on the new VM. The new VM is running IIS 8.5, SQL Express 2014 and Windows Server 2012 R2 Datacenter. I have set up the website in IIS and given read/write permissions to NETWORK SERVICE and IIS_IUSRS. The web.config file can be read as if I type something silly I get a syntax error showing the correct line.
Now here is where things diverge from the trivial (for me at least). I can connect to the database (on the local machine) using Management Studio, HeidiSQL and the Data Link Properties dialog (see https://www.sophos.com/en-us/support/knowledgebase/65525.aspx). All three of those work fine. When I put the connection string into the web.config, I get the can't connect error. The precise message is "DNN Error Connection To The Database Failed".
Here's the connection string I'm using, it's nothing special and is what the production server is currently using, though with a different data source of course:
Data Source=[machine]\[instance];Initial Catalog=[database]; User ID=[user];Password=[password];
I'm guessing it's not the database itself since that seems to be fine and I can connect to it as mentioned, so I'm thinking maybe something in IIS?
Any help would be appreciated.

SSIS connection to Informix does not save password

I'm using SSIS 2012 to connect to an Informix database (Avaya CMS) via n ADO NET connection.
I've set the debugging run64bit to false in the project properties. so it should use the 32bit informix openlink drivers.
We've got an OpenLink ODBC connection set up that works with Access and that I'm able to create the connection manager in SSIS with. When I enter the password in the connection manager and test the connection it's fine.
I go to create an ADO net datasource and I get prompted to input the password. Fine I do and I can see the tables from CMS and choose one as a data source.
When I go to preview it I get errors: A whole lot of
ERROR [HY010] [OpenLink][ODBC][Driver]Function sequence error
followed at the end by
at System.Data.Odbc.OdbcDataReader.NextResult(Boolean disposing, Boolean allresults)
at System.Data.Odbc.OdbcDataReader.Close(Boolean disposing)
at System.Data.Odbc.OdbcDataReader.Close()
at Microsoft.SqlServer.Dts.Pipeline.DataReaderSourceAdapter.ReinitializeMetaData()
at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostReinitializeMetaData(IDTSManagedComponentWrapper100 wrapper)
Does anyone know what could be causing this and how can I get around it?
Thanks

How do I avoid the connection manager breaking in SSIS?

I made some changes to the connection manager yesterday, using SQL Authentication instead of Windows authentication. But today for some reason all the connections had red x's whene I opened them. Then I reverted back to using Windows authentication and the same issue persisted. I had to go into each object and re-add the connections.
I'm using an OLE DB connection that is being used as a project connection.
Also when I'm transferring a single package to someone else. For some reason he is unable to view and use the connection manager? Any reason why this could be and how I can solve it.

How to Write data to Sql Table from SharePoint WebPart when DB and SP are on different machine?

I am working on SharePoint 2013. Database is on SqlServer 2008R2. Both SP and DB are on different machines. I am creating a webPart which is associated with usercontrol. I'm writing the logic in cs file of usercontrol, to write data collected from the form into Data table of sql server.
Connection string: Server=myServerAddress;Database=myDataBase;User
Id=myUsername; Password=myPassword;
But it is failing and throwing an error like "Login failed for user".
Please guide.
You may be running into the Double Hop Problem (also see why NTLM fails). To know for sure use ULSViewer to drill into the SharePoint Error details. From the SQL side check the default trace. "default trace gives you the reason for login failure in plain English"
If it is the double hop causing the error, you may want to look into configuring Kerberos or switching to using an External List instead of a web part and using the Secure Store Service with BCS.

Can't access SQL Server file in the server machine

I setup the my WCF service on server machine.
The server OS is Windows 2008 with SQL Server 2008 Express.
I am trying to access to my SQL Server (mdf) file to read data using LINQ to SQL.
I see that the DataContext is OK - but when I try to get information that in one of the table I get an exception
Failed to generate a user instance of
SQL Server due to failure in
retrieving the user's local
application data path. Please make
sure the user has a local user profile
on the computer. The connection will
be closed.
I don't know what i need to define or change in the IIS 7.5 that I'm using in the server side.
Thanks for any help.
Update: the connection to the database file is fine - but getting information from table is thru an exception. The connection string is:
Data Source=.;AttachDbFilename=|DataDirectory|\ServiceData.mdf;
Integrated Security=SSPI;User Instance=True
If you already have a server, why don't you just attach the MDF to the SQL Server (Express) running, and then use it like a normal database on your server?
After you do this, use a connection string like:
server=Server\SQLExpress;Database=YourDatabaseName;Integrated Security=SSPI
I never quite liked the AttachDbFileName= and User Instance approach - seems like a (unreliable) hack to me, which really doesn't make sense if you're running on a server machine.
The reason that you are getting this error message is because your code is in the security context of a user that has never logged on to the server. The user therefore does not have a profile and you therefore get an error when the code attempts to write to a non-existant profile.
You could use marc_s's approach or you could run as a user that has a profile.

Resources