Click here to Skip to main content
11,806,590 members (66,431 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET ActiveX
Hello all

I am using ActiveX in my web application in one page, it is working properly in my PC, i am passing the connection string from the web page that has the activex in it as following:

This is the javascript code in the page that passing the connection string to the activex:

<script language="javascript" type="text/javascript">
      function Connect() {
          var doc = document.forms[0];
          var PrinterControl = document.applets('PrinterObject1');
          PrinterControl.UserText = document.form1.hdnConString.value + ',' + document.form1.hdnCategory.value + ',' + document.form1.hdnLoginID.value + ',' + document.form1.hdnPassword.value + ',' + document.form1.hdnCategoryType.value;
<body  önload="Connect()">
    <form id="form1"  runat="server" >

and in the activeX code i receive the connection string and other values as following:

public String UserText
               return conString;
                conString = value;
                string[] arrID = conString.Split(',');
                conStr = Convert.ToString(arrID[0]);
                category = Convert.ToString(arrID[1]);
                loginID = Convert.ToString(arrID[2]);
                password = Convert.ToString(arrID[3]);
                categoryType = Convert.ToString(arrID[4]);

Every thing working properly in my pc, but when i install this application in customer's server, the page that using activex generating error although it is working in my pc and i tested it in other pcs in my company over network still working ok, the customer using Windows2008 with sql server 2012.

The following is the error message generating in the page that using activex, when the page trying to load activex:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 = could not open a connection to SQL Server)

Please help

Thank you
Posted 25-Mar-13 23:58pm
Edited 26-Mar-13 6:49am
aspnet_regiis -i at 26-Mar-13 13:12pm
You are passing the connection string to client side???? Do you want the user to read the connection string and hack the database and purchase everyting for free from your website?
Medo-I at 26-Mar-13 14:14pm
yes iam passing the connection string to the client side, into the activex code, how the user will see the connection string although it is passing inside the code, unfortunately i don't have background in security especially against hackers, anyway this application using inside intranet and not for internet use, also the activex code converted to setup file and installed in every client pc to run the web page that contains the activex.

i think i really need to read a lot in this subject, thanks a lot.
aspnet_regiis -i at 27-Mar-13 2:19am
Just right click on the page and select view source . You can see the connection string in the javascript
Medo-I at 27-Mar-13 4:03am
this is really good advice, i tried it in my client side and i saw my connection string, i thing i have to encrypt the connection string.

Thank you

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

As the error message suggests, the problem is probably not related to your code: it is a SQL Sever configuration issue (and Google is your friend[^]).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 ppolymorphe 205
1 OriginalGriff 175
2 Richard Deeming 175
3 Sergey Alexandrovich Kryukov 170
4 Abhinav S 120
0 OriginalGriff 3,380
1 Maciej Los 1,990
2 CPallini 1,915
3 KrunalRohit 1,907
4 ppolymorphe 1,317

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 26 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100