Showing posts with label service. Show all posts
Showing posts with label service. Show all posts

Thursday, March 29, 2012

pass login info back from web service

I am trying to build a web service and link it to my site for authenitcation of users

works fine as long as i am check for a boolean

what i want to do is have it pass back several parameters -- accesslevel, firstname, lastname

how can i do this?

and how can i get the different values into my asp.net page?

you can define your own soap header where you deliver your requested data.

before you execute your webservice, you verify the header information and then you run into your method.

even if you dont speak german, check the code sample at the following page:http://www.aspheute.com/artikel/20030501.htm this explains it pretty simple..


You can either return a DataSet containing a DataTable with the required columns, or create a custom class that has these as fields (make sure it is serializable).

Pass Recordset from Web Service to Classic ASP.

I want to use the .net Web Service to create a function and return the
datas (RecordSet). And want to retrived those data on the classic ASP.
Does any body have some example of this. How to create the Recordset in
webservice and get it at classic asp.
Thanks and Regards.Ted Ngo wrote:
> I want to use the .net Web Service to create a function and return the
> datas (RecordSet). And want to retrived those data on the classic ASP.
> Does any body have some example of this. How to create the Recordset
> in webservice and get it at classic asp.
> Thanks and Regards.
See this thread:
http://groups.google.com/group/micr...29ded2e3b036cec
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
so I using this
Or, you can send the XML of the ADO recordset back, and re-construct it
on
the client. Use Interop on the server to work with the ADO recordset.
// ON THE SERVER -- Web Service
// Add references to ADODB library
// Create a stream object
myStream = new ADODB.Stream();
// Replace the constants with their actual values
recordSet.Save(myStream, adPersistXML);
output = myStream.ReadText(adReadAll);
// Return the XML string, complete with schema
return output;
To return the recorset
and then on the asp using this to get the record set
Public Function RecordsetFromXMLString(sXML As String) As Recordset
Dim oStream As ADODB.Stream
Set oStream = New ADODB.Stream
oStream.Open
oStream.WriteText sXML 'Give the XML string to the ADO Stream
oStream.Position = 0 'Set the stream position to the start
Dim oRecordset As ADODB.Recordset
Set oRecordset = New ADODB.Recordset
oRecordset.Open oStream 'Open a recordset from the stream
oStream.Close
Set oStream = Nothing
Set RecordsetFromXMLString = oRecordset 'Return the recordset
Set oRecordset = Nothing
End Function
Is that righ?
Thanks
Yes, that's what I had in mind. Also, see Adam's last message in that
thread.
Bob
Ted Ngo wrote:
> so I using this
> Or, you can send the XML of the ADO recordset back, and re-construct
> it on
> the client. Use Interop on the server to work with the ADO recordset.
>
> // ON THE SERVER -- Web Service
> // Add references to ADODB library
>
> // Create a stream object
> myStream = new ADODB.Stream();
>
> // Replace the constants with their actual values
> recordSet.Save(myStream, adPersistXML);
> output = myStream.ReadText(adReadAll);
>
> // Return the XML string, complete with schema
> return output;
> To return the recorset
> and then on the asp using this to get the record set
> Public Function RecordsetFromXMLString(sXML As String) As Recordset
> Dim oStream As ADODB.Stream
> Set oStream = New ADODB.Stream
> oStream.Open
> oStream.WriteText sXML 'Give the XML string to the ADO Stream
> oStream.Position = 0 'Set the stream position to the start
> Dim oRecordset As ADODB.Recordset
> Set oRecordset = New ADODB.Recordset
> oRecordset.Open oStream 'Open a recordset from the stream
> oStream.Close
> Set oStream = Nothing
> Set RecordsetFromXMLString = oRecordset 'Return the recordset
> Set oRecordset = Nothing
> End Function
> Is that righ?
> Thanks
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Monday, March 26, 2012

Pass through credentials to web service

Hey all -
I'm in a bit of a bind concerning web services and integrated
authentication. I'll give you a little background as to what I'm trying
to do ...
I have a client application that calls a web service. The web service
uses integrated windows authentication (with identity impersonation =
true in Web.Config) with anonymous authentication turned off in IIS.
Calling the web service works as expected - users that can get to it
get to it, users that don't get a 401 Access Denied. I want this web
service to also make a call to a database sitting on a remote SQL
Server using the same credentials that were passed through to the web
service (for example, Domain\UserA access web service, web service
calls Sql Server with login of Domain\UserA. UserB access web service,
web service calls SQL Server with login of Domain\UserB, etc.)
The problem arises when I try to access the SQL box; I always get the
following error:
Login failed for user '(null)'. Reason: Not associated with a trusted
SQL Server connection.
I've seen numerous posts about this online, but none really with a
definitive answer as to what I should do. If I use Basic Authentication
in IIS with everything else unchecked, the web service works (except it
always asks for a login/password, thus throwing a 401 code when the
client app tries calling it). I figure there has to be a way to get
these credentials to be passed through in a secure manner, I just
haven't found it.
Does anyone have any ideas?
Thanks!
ClintDid you set WebClientProtocol.Credentials in client side?
It is the double-hop' limitation of NTLM authentication. The client's
credentials can make one hop from the client machine to the
application server, the server cannot then use those credentials to
make a second network hop without some additional config work.
See: http://blogs.msdn.com/nunos/archive...3/12/88468.aspx
Scott
http://www.OdeToCode.com/blogs/scott/
On 20 Dec 2004 12:36:04 -0800, "cmueller@.online.nospam"
<cjmueller@.gmail.com> wrote:

>Hey all -
>I'm in a bit of a bind concerning web services and integrated
>authentication. I'll give you a little background as to what I'm trying
>to do ...
>I have a client application that calls a web service. The web service
>uses integrated windows authentication (with identity impersonation =
>true in Web.Config) with anonymous authentication turned off in IIS.
>Calling the web service works as expected - users that can get to it
>get to it, users that don't get a 401 Access Denied. I want this web
>service to also make a call to a database sitting on a remote SQL
>Server using the same credentials that were passed through to the web
>service (for example, Domain\UserA access web service, web service
>calls Sql Server with login of Domain\UserA. UserB access web service,
>web service calls SQL Server with login of Domain\UserB, etc.)
>The problem arises when I try to access the SQL box; I always get the
>following error:
>Login failed for user '(null)'. Reason: Not associated with a trusted
>SQL Server connection.
>I've seen numerous posts about this online, but none really with a
>definitive answer as to what I should do. If I use Basic Authentication
>in IIS with everything else unchecked, the web service works (except it
>always asks for a login/password, thus throwing a 401 code when the
>client app tries calling it). I figure there has to be a way to get
>these credentials to be passed through in a secure manner, I just
>haven't found it.
>Does anyone have any ideas?
>Thanks!
>Clint
Shoot - I was afraid that was the case. I had figured that there'd be a
generally easy way to do this, but I guess not.
Anyway, thanks for your reply!
Clint

Pass through credentials to web service

Hey all -

I'm in a bit of a bind concerning web services and integrated
authentication. I'll give you a little background as to what I'm trying
to do ...

I have a client application that calls a web service. The web service
uses integrated windows authentication (with identity impersonation =
true in Web.Config) with anonymous authentication turned off in IIS.
Calling the web service works as expected - users that can get to it
get to it, users that don't get a 401 Access Denied. I want this web
service to also make a call to a database sitting on a remote SQL
Server using the same credentials that were passed through to the web
service (for example, Domain\UserA access web service, web service
calls Sql Server with login of Domain\UserA. UserB access web service,
web service calls SQL Server with login of Domain\UserB, etc.)

The problem arises when I try to access the SQL box; I always get the
following error:

Login failed for user '(null)'. Reason: Not associated with a trusted
SQL Server connection.

I've seen numerous posts about this online, but none really with a
definitive answer as to what I should do. If I use Basic Authentication
in IIS with everything else unchecked, the web service works (except it
always asks for a login/password, thus throwing a 401 code when the
client app tries calling it). I figure there has to be a way to get
these credentials to be passed through in a secure manner, I just
haven't found it.

Does anyone have any ideas?

Thanks!
ClintDid you set WebClientProtocol.Credentials in client side?
It is the double-hop' limitation of NTLM authentication. The client's
credentials can make one hop from the client machine to the
application server, the server cannot then use those credentials to
make a second network hop without some additional config work.

See: http://blogs.msdn.com/nunos/archive...3/12/88468.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 20 Dec 2004 12:36:04 -0800, "cmueller@.online.nospam"
<cjmueller@.gmail.com> wrote:

>Hey all -
>I'm in a bit of a bind concerning web services and integrated
>authentication. I'll give you a little background as to what I'm trying
>to do ...
>I have a client application that calls a web service. The web service
>uses integrated windows authentication (with identity impersonation =
>true in Web.Config) with anonymous authentication turned off in IIS.
>Calling the web service works as expected - users that can get to it
>get to it, users that don't get a 401 Access Denied. I want this web
>service to also make a call to a database sitting on a remote SQL
>Server using the same credentials that were passed through to the web
>service (for example, Domain\UserA access web service, web service
>calls Sql Server with login of Domain\UserA. UserB access web service,
>web service calls SQL Server with login of Domain\UserB, etc.)
>The problem arises when I try to access the SQL box; I always get the
>following error:
>Login failed for user '(null)'. Reason: Not associated with a trusted
>SQL Server connection.
>I've seen numerous posts about this online, but none really with a
>definitive answer as to what I should do. If I use Basic Authentication
>in IIS with everything else unchecked, the web service works (except it
>always asks for a login/password, thus throwing a 401 code when the
>client app tries calling it). I figure there has to be a way to get
>these credentials to be passed through in a secure manner, I just
>haven't found it.
>Does anyone have any ideas?
>Thanks!
>Clint
Shoot - I was afraid that was the case. I had figured that there'd be a
generally easy way to do this, but I guess not.
Anyway, thanks for your reply!
Clint