Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Authentication with HTTP libarary problem

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-25-2007, 10:37 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default Authentication with HTTP libarary problem

I am failing dismally as I have little knowledge of the HTTP protocol. Has anyone coded access to a site that uses "Basic authentication without secure communication" using the HTTP library on the desktpop?
Reply With Quote
  #2 (permalink)  
Old 12-25-2007, 10:54 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,732
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

What error do you get?
Are you using WebRequest.New3(...) ?
Reply With Quote
  #3 (permalink)  
Old 12-25-2007, 11:17 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by Erel View Post
What error do you get?
Are you using WebRequest.New3(...) ?
Hi Erel - Happy Xmas or whatever! I get a 401 exception thrown. No, I'm not using New3 - the Help only shows a New1 and a New2. I had assumed that I would need access to the Request headers to insert an Authorization line but they are read-only!

I have now tried New3 and get "Response.Value = Request.GetResponse" Error description: "The server committed a protocol violation. Section=ResponseHeader. Detail=CR must be followed by LF. Continue?"

The server in this case is the internal side of my router - I am practicing for a remote house monitoring system for a friend of mine. Looks like it won't work with the router - I shall have to wait for him to come up with the real server which will also have this sort of authentication.
Reply With Quote
  #4 (permalink)  
Old 12-25-2007, 11:30 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,732
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

I've seen this error before on one site.
I don't know how to explain it. Other sites (with authentication) work flawlessly.
Merry Christmas and a happy new year!
Reply With Quote
  #5 (permalink)  
Old 12-25-2007, 11:35 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by Erel View Post
I've seen this error before on one site.
I don't know how to explain it. Other sites (with authentication) work flawlessly.
Merry Christmas and a happy new year!
I googled for the error and I've fixed it now I know about New3. Needs this adding to the dbasic.exe.config (while debugging) and the exe.config of the final app. Can I suggest you do this on the next release!

Code:
<system.net>
  <settings>
    <httpWebRequest useUnsafeHeaderParsing=
"true" />
  </settings>
</system.net
.NET is very (too) strict on parsing headers by default - this relaxes it.
Reply With Quote
  #6 (permalink)  
Old 12-25-2007, 11:48 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Erel - idiot level questions I'm afraid!

I presume I need to "New3" the WebRequest object on every call to an authenticated server rather then "New1"s after the first. Does "KeepAlive" have any significance here?

I presume I also need to perform a "New1" and "Close" pair on the WebResponse for every call as well.

Thanks for the help so far.
Reply With Quote
  #7 (permalink)  
Old 12-25-2007, 11:50 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,732
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Very interesting. Solves a few mysteries.

Quote from MSDN:
Quote:
Setting this property to true has security implications, so it should only be done if backward compatibility with a server is required.
I think that it is better to use the default .Net behavior and let the user override it if required.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTTP library v1.4 Erel Official Updates 2 10-29-2008 09:11 PM
HTTP Bug NEW3 dibesw Italian Forum 5 08-02-2008 12:21 PM
http get JPG to Image mamuen Questions (Windows Mobile) 2 03-26-2008 08:42 PM
HTTP Post nsidney Questions (Windows Mobile) 4 01-30-2008 09:52 AM
HTTP Lib problem Lasse Questions (Windows Mobile) 5 06-04-2007 03:49 PM


All times are GMT. The time now is 06:19 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0