Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / September 2004

Tip: Looking for answers? Try searching our database.

Basic Authentication ... solution seems a mystery?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pete - 10 Sep 2004 05:53 GMT
I'm cross posting from mscom.webservices.general as I have received no answer
there:

There has been a number of recent posts requesting how to satisfactorily
enable BASIC authorization at the HTTP level but as yet no fully useful
answer.

I too have been trying to call an apache/axis webservice which desires a
username/password from my C# Client. (ie the equivalent of
_call.setUsername("Myname") name from within a Java client proxy) Try as I
may I cannot get the AUTHORIZATION attribute to be included in the http
header. Some mention has been made of directly inserting the attribute into
the header ... but how does one get hold of the request object to do this?
Using the Credentials object method does not work for me.

Any clues ..?
Jared - 10 Sep 2004 21:49 GMT
I think you just have to create a class that inherits from SoapHeader, then
include the <SoapHeader()> attribute to the method that will use it.  I hope
I understood your question correctly.

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemWebServicesProtocolsSoapHeaderAttributeClassTopic.htm

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconalteringsoapmessageusingsoapextensions.htm

> I'm cross posting from mscom.webservices.general as I have received no
> answer
[quoted text clipped - 14 lines]
>
> Any clues ..?
Pete - 11 Sep 2004 03:15 GMT
Thanks Jared,
However I'm looking for authentication at the http level not at the soap
level.
The SOAP/AXIS server I'm looking to connect my client desires basic
authentication
within the http header.
ie looking to see how to set the AUTHENTICATION attribute within the http
header.
Pete

> I think you just have to create a class that inherits from SoapHeader, then
> include the <SoapHeader()> attribute to the method that will use it.  I hope
[quoted text clipped - 22 lines]
> >
> > Any clues ..?
Jared - 11 Sep 2004 04:01 GMT
Sorry about that.
   Try looking into the System.Net.WebHeaderCollection object or the
System.Net namespace in general. The webclient may have the functionality
you are looking for.

> Thanks Jared,
> However I'm looking for authentication at the http level not at the soap
[quoted text clipped - 38 lines]
>> >
>> > Any clues ..?
old - 11 Sep 2004 11:21 GMT
take a look at this link
Pass Current Credentials to an ASP.NET Web Service
http://support.microsoft.com/?kbid=813834

> Sorry about that.
>     Try looking into the System.Net.WebHeaderCollection object or the
[quoted text clipped - 45 lines]
>>> >
>>> > Any clues ..?
Pete - 13 Sep 2004 02:43 GMT
Thanks ... however I am aware of this, but the Credentials technique
(discussed int the link you kindly prvided) passes the credentails at the
SOAP Header level not the HTTP header level which in my case is desired for
the APache/AXIS server.
In the meantime I am looking at the info that Jared supplied.
PS I'm not using a web client, rather a windows forms client.
Pete

> take a look at this link
> Pass Current Credentials to an ASP.NET Web Service
[quoted text clipped - 49 lines]
> >>> >
> >>> > Any clues ..?
Jared - 13 Sep 2004 03:03 GMT
I was referring to the System.Net.WebClient. You can send a post message to
a client with this class, I believe you can modify the headers, it's been a
while since i've used it.

> Thanks ... however I am aware of this, but the Credentials technique
> (discussed int the link you kindly prvided) passes the credentails at the
[quoted text clipped - 58 lines]
>> >>> >
>> >>> > Any clues ..?
Pete - 13 Sep 2004 09:43 GMT
Thanks Jared, however I'm not using a web client, I'm using Windows Forms
client(and I've tried a console client to keep things simple with the same
results). I have only have the web reference. So I think I need to be able
somehow to get the web request object and from there access the Http Request
object and from there be able to set the contents of the http header ???
Anyone any clues or examples on how to do this? It's the same problem as my
orginal question however I'm not getting any closer it seems.

When I use a Java client, it's really easy to set the http AUTHORIZATION
attributes. Not so apparently in .Net. This is so basic I'll bet the answer
is really easy but it has me stumped :)

Pete

> I was referring to the System.Net.WebClient. You can send a post message to
> a client with this class, I believe you can modify the headers, it's been a
[quoted text clipped - 62 lines]
> >> >>> >
> >> >>> > Any clues ..?
Jared - 13 Sep 2004 11:29 GMT
Pete,
   I'm not talking about a browser or a web page, I too am talking about a
.NET WinForms application. Take the following code snippit for example:

Sub PostAMessage()
   Dim Site As String = "http://www.yoursite.com"
   Dim Web As New System.Net.WebClient
   Web.Headers.Add("AUTHORIZATION", "SOMEVALUE")
   Dim Stream As System.IO.Stream
   Stream = Web.OpenRead(Site)
   Dim Reader As New System.IO.StreamReader(Stream)
   Dim Output As String = Reader.ReadToEnd()
   Stream.Flush()
   Stream.Close()
   Reader.Close()
End Sub

This code is declared and used inside a windows application. The name of the
object I have been referring to is WebClient. You may want to see if it can
handle what you are trying to do.

Jared

> Thanks Jared, however I'm not using a web client, I'm using Windows Forms
> client(and I've tried a console client to keep things simple with the same
[quoted text clipped - 89 lines]
>> >> >>> >
>> >> >>> > Any clues ..?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.