Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Authentication with HTTP libarary problem


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-25-2007, 11:37 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,770
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
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, 11:54 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

What error do you get?
Are you using WebRequest.New3(...) ?
Reply With Quote
  #3 (permalink)  
Old 12-25-2007, 12:17 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,770
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
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, 12:30 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
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, 12:35 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,770
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
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, 12:48 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,770
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
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, 12:50 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
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 On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 05:02 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0