473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Web Service within ASP.net application

I have a web application developed in ASP.net 2.0. I have to use SQL
server authentication (Our outside hosting company only allows sql
authentication)

Inside that web application I have a web service referenced that is
actually hosted within our company.
When you use that web service within your ASP.net web application.
What account is used by that web service? (anonymous account use by
ASP.net web application? Can that web service use a different account)
Sorry for my english..

Apr 3 '07 #1
4 2710
Yes, you can impersonate the service to run under a dedicated Windows
account. I am doing this in an Intranet application. One advantage of using a
dedicated account, is that allows Connection Pooling when different users
connects to the database. The downsize is that you have to use the user
account/password in the code, something that may not respect the segragation
of duties principle in some companies (where the application administrator is
different from the SQL administrator).

private void StartWebServiceAsReadOnlyIdentity()
{
CredentialCache credentialCache = new CredentialCache();

// Create a new instance of NetworkCredential using the client
// credentials.
NetworkCredential credentials = new NetworkCredential();
credentials.UserName = m_strReadOnlyUserName;
credentials.Password = m_strReadOnlyUserPassword;
credentials.Domain = m_strReadOnlyUserDomain;

// Add the NetworkCredential to the CredentialCache.
credentialCache.Add(new Uri(service.Url),
"Negotiate", credentials);

// Add the CredentialCache to the proxy class credentials.
service.Credentials = credentialCache;
}
"c_shah" wrote:
I have a web application developed in ASP.net 2.0. I have to use SQL
server authentication (Our outside hosting company only allows sql
authentication)

Inside that web application I have a web service referenced that is
actually hosted within our company.
When you use that web service within your ASP.net web application.
What account is used by that web service? (anonymous account use by
ASP.net web application? Can that web service use a different account)
Sorry for my english..

Apr 3 '07 #2
The account used by the webservice depends on the iis settings for the
webservice.
To use different account for the webservice from your calling code,
you can supply the credentials after creating the web service object
using webService.Credentials property.
You can also configure the account used in the iis settings for the
web service if you want to configure that for all consumers.

Apr 3 '07 #3
Hi Latish,
>>You can also configure the account used in the iis settings for the
web service if you want to configure that for all consumers.
Did you mean to change anonymous account used by web service to a
specific account. Please advise. Thanks.

Apr 4 '07 #4
That depends on your requirements. If you enable anonymous access and
give the anonymous access account some rights or if you enable
impersonation , any user accessing the web service will have those
privileges.
If you want only specific(valid) users to be able to use the web
service, then you should enable windows authentication and pass in the
required credentials.
Check out http://www.15seconds.com/issue/020312.htm
and http://dotnetjunkies.com/Tutorial/5D...721A3FDF6.dcik
for a better understanding.

Apr 5 '07 #5

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

Similar topics

0
by: Ross Bennett | last post by:
Ahoy, Folks! I've been looking all over for this, but I just can't seem to shake any documentation out of the MSDN or from Google. I've reviewed every .NET article on developing Windows...
3
by: Jeremy S. | last post by:
On my dev machine (XP/Pro with VS.NET 2003) I have been developing a Windows Service and installing it on the local machine by opening the Visual Studio Command Prompt and then executing . Now I...
2
by: Randall Powell | last post by:
I am in the process of developing a Windows Service which will: (1) monitor multiple network shares; (2) marshal text file transfers into an SQL Server 2000 instance; and (3) provide messaging...
5
by: Andrew | last post by:
Hey all, Requesting help from the VB.Net gurus in here. I was given a task to write a Windows Service (VB.Net) that would run an external program, and if that program closed for any reason...
3
by: =?Utf-8?B?RGFuZGFuIFpoYW5n?= | last post by:
Now I have a web application, a web service and a SQL Server database. The Web application will invoke the web service, the web service invokes the SQL Server stored procedure. I let the web...
3
by: Diego L Espiñeira | last post by:
Hi, all I've got a windows service (server) application and a winforms (client) application. What I need to do is to host a web service in the windows service application so the client can request...
6
by: Joseph Geretz | last post by:
I have the following class which I am serializing and passing back and forth between my Web Service application and the client. public class Token : SoapHeader { public string SID; public...
5
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name?...
22
by: robertgregson | last post by:
Using C#, .NET3.5, Visual Studio 2008 and WCF on Windows VISTA SP1, I have written a service, service host (as a C# console application) and a client. The service uses...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.