473,770 Members | 4,055 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question on how to manage SQL Server connection string

Hello,

I'm developing a web services apllication using SQL Server in mixed mode.
I'm also using WSE 3.0.
For each user in the application there's a corresponding user on the
database. The client always sends the username to the web service for
identification.
I have a connection string stored in the web service for the visual
designed
datasets and for the connection I make manually.
I need that the connection string includes the user information for each
user connecting to the web service, so that when I receive a request
from the
client I can change the connection string for everything done under that
request, including using tableadapters to fill datasets, etc..
What is the best approach to make the web service use the information
received from the client to build a valid connection string that can be
used
only for that specific request, but that is visible to everything in the
web
service, including datasets built using the visual editor?
Thanks in advance for any help given.

Regards,
paulo
Feb 28 '06 #1
3 4810
Hi paulo,

Welcome to the MSDN newsgroup.

From your description, I understand you have an ASP.NET 2.0 webservice
which use WSE 3.0 to secure the communication between client and get the
full credential (username/password) from client user. Also, since you'll
need to make connection to backend sqlserver database which accept SQL
Server authentication mode, you're wondering how to dynamiccally make the
connection(in Tableadapter) use the username/password from the webservice
client user's authenticated credential, correct?

Based on my experience, if you've corrected get the clear text
username/password from client authenticated user in webservice, what we
need to do is how to dynamically assign these credential to the Data
connection's connection string (the Tableadapter). I'm not sure whether
you're currently creating the Tableadaper in your ASP.NET project or in a
separate class library project. IMO, I'd prefer put it in a separate class
library project because that'll provide us more options to customize the
TableAdapter(in clude the connectionstrin g...). Here are some options you
can consider:

1. Since in winform or class library project, the DataSet/tableAdatper's
designer generated code is available to us in the xxxx.designer.c s file, we
can manually modify some of them or add our own function to customize the
connection string or the sqlconnection member to use the credentials in our
webservice. (e.g extract the main part from the orginal connection string
and concatenate it with the usename/password from webservice client).

2. If you do not want to modify those designer generated code(since they'll
be regenerated), the Tableadapter has a property named
"Connection--Modifier"(you can find it in the TableAdapter's property
grid), we can set this to "Public" so that we can create our own
SqlConnection instance and assign it to the TableAdapter at runtime, this
is also one possible approach.

Hope these help.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Mar 1 '06 #2
Hello Steven,

Just to thank you for your reply. Using your advice I've found the
solution to the problem.
Thanks!

Regards,
paulo

Steven Cheng[MSFT] wrote:
Hi paulo,

Welcome to the MSDN newsgroup.

From your description, I understand you have an ASP.NET 2.0 webservice
which use WSE 3.0 to secure the communication between client and get the
full credential (username/password) from client user. Also, since you'll
need to make connection to backend sqlserver database which accept SQL
Server authentication mode, you're wondering how to dynamiccally make the
connection(in Tableadapter) use the username/password from the webservice
client user's authenticated credential, correct?

Based on my experience, if you've corrected get the clear text
username/password from client authenticated user in webservice, what we
need to do is how to dynamically assign these credential to the Data
connection's connection string (the Tableadapter). I'm not sure whether
you're currently creating the Tableadaper in your ASP.NET project or in a
separate class library project. IMO, I'd prefer put it in a separate class
library project because that'll provide us more options to customize the
TableAdapter(in clude the connectionstrin g...). Here are some options you
can consider:

1. Since in winform or class library project, the DataSet/tableAdatper's
designer generated code is available to us in the xxxx.designer.c s file, we
can manually modify some of them or add our own function to customize the
connection string or the sqlconnection member to use the credentials in our
webservice. (e.g extract the main part from the orginal connection string
and concatenate it with the usename/password from webservice client).

2. If you do not want to modify those designer generated code(since they'll
be regenerated), the Tableadapter has a property named
"Connection--Modifier"(you can find it in the TableAdapter's property
grid), we can set this to "Public" so that we can create our own
SqlConnection instance and assign it to the TableAdapter at runtime, this
is also one possible approach.

Hope these help.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Mar 14 '06 #3
Thanks for your followup Paulo,

Glad that my suggestion is of assistance.

Best Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Mar 15 '06 #4

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

Similar topics

4
2433
by: Benne Smith | last post by:
In our company, i have three servers; 1) a development server (mine only - here i make daily changes and test my stuff) 2) a test server (for the users to test milestone builds - changes weekly) 3) production server (for when a new build is fully tested, and stable) The problem is that the connectionstring in the web.config, should be replaced with something else, for each of the enviroments.
2
1385
by: Bob | last post by:
I would like to use integrated security for DB connection for my ASP.NET applications. Since these apps have different databases (SQL Server), I want each app to be able to access its own database. Say if I have 10 apps, I'd need 10 logins, one login for each DB. Now throw in the windows integrated security, I need 10 windows account. However, in order to run an ASP.NET app under a certain identity, it has to have its own application...
7
2241
by: News | last post by:
Hello, I have to build a program with the future in mind and I need a bit of guidance from a guru or two. My program will start as a multi-user Windows Application built with VB.Net and using an Access 2002 database backend. The future will require that 1. The database be switched with minimal effort to SQL Server and 2. A Web Application be added to allow web access to reports generated from the database. At this time, there is no...
8
3385
by: Ben R. | last post by:
Hi all, This is a multipart question. I’ve got an asp.net site that contains an access database. Previously, I would debug by making changes and uploading to my host. Now, I’d like to be able to debug locally and then deploy. I’d really like to use a relative path for the database file (so I could make no changes between hostide and debugging client side. When I try to use a relative path, it doesn’t seem to be referring to...
5
2518
by: Michael Moreno | last post by:
Hello, In a class I have this code: public object Obj; If Obj is a COM object I would like to call in the Dispose() method the following code: System.Runtime.InteropServices.Marshal.ReleaseComObject(Obj);
4
3605
by: Engineerik | last post by:
I am trying to create a socket server which will listen for connections from multiple clients and call subroutines in a Fortran DLL and pass the results back to the client. The asynchronous socket client and asynchronous socket server example code provided in the .NET framework developers guide is a great start but I have not dealt with sockets before and I am struggling with something. From what I can tell the sample server code ...
20
3299
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how many connection has been used ? 2. If the maximum pool size has been reached, what happens when I call the method Open to open the connection ? Will I get an error ? MSDN says the request is queued, but will I get an error in the open method ? ...
5
5895
by: jehugaleahsa | last post by:
Hello: What is the point of using a DataTable in ASP .NET? We are unsure how you can use them without 1) rebuilding them every postback, or 2) taking up precious memory. We are not sure how to store a DataTable in any other way outside of our servers. In doing so, we leave ourselves open to large memory requirements. Furthermore, most web pages do not really support multiple changes per transaction. In other words, when the user submits...
6
1370
by: CSharper | last post by:
We have a good size project and there we will connect to sql from different projects. What is the best practice to connect to sql? I am pretty sure, writing the hard coded is not a good solution. I could create class which could encapsulate all the tasks for the project and we create the instance and consume them in the project. But with this every time, I try to create a new instance I would end up creating a new sql connection. Do you...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10230
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
10058
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
8886
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
7416
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
6678
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
5313
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...
0
5450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.