Click here to Skip to main content
15,914,924 members
Home / Discussions / C#
   

C#

 
GeneralRe: Multiple Field Sorting C# Pin
dsrao18-Jul-09 9:13
dsrao18-Jul-09 9:13 
QuestionProcess.workingset Pin
hpydir17-Jul-09 14:53
hpydir17-Jul-09 14:53 
AnswerRe: Process.workingset Pin
Luc Pattyn17-Jul-09 15:03
sitebuilderLuc Pattyn17-Jul-09 15:03 
Questionhelp Pin
unlucky_dreamer17-Jul-09 12:45
unlucky_dreamer17-Jul-09 12:45 
AnswerRe: help Pin
DaveyM6917-Jul-09 13:20
professionalDaveyM6917-Jul-09 13:20 
GeneralRe: help Pin
Michael Schubert17-Jul-09 22:06
Michael Schubert17-Jul-09 22:06 
QuestionMS Word Automation - Combining word documents Pin
venadder17-Jul-09 11:25
venadder17-Jul-09 11:25 
QuestionDelegates - I don't Get It Pin
eddieangel17-Jul-09 7:52
eddieangel17-Jul-09 7:52 
AnswerRe: Delegates - I don't Get It Pin
harold aptroot17-Jul-09 8:14
harold aptroot17-Jul-09 8:14 
AnswerRe: Delegates - I don't Get It Pin
CodingYoshi17-Jul-09 8:20
CodingYoshi17-Jul-09 8:20 
GeneralRe: Delegates - I don't Get It Pin
eddieangel17-Jul-09 8:35
eddieangel17-Jul-09 8:35 
GeneralRe: Delegates - I don't Get It Pin
DaveyM6917-Jul-09 10:47
professionalDaveyM6917-Jul-09 10:47 
GeneralRe: Delegates - I don't Get It Pin
eddieangel17-Jul-09 11:00
eddieangel17-Jul-09 11:00 
GeneralRe: Delegates - I don't Get It Pin
DaveyM6917-Jul-09 11:26
professionalDaveyM6917-Jul-09 11:26 
GeneralRe: Delegates - I don't Get It Pin
DaveyM6917-Jul-09 11:39
professionalDaveyM6917-Jul-09 11:39 
AnswerRe: Delegates - I don't Get It Pin
Luc Pattyn17-Jul-09 10:13
sitebuilderLuc Pattyn17-Jul-09 10:13 
GeneralRe: Delegates - I don't Get It Pin
Baeltazor17-Jul-09 22:28
Baeltazor17-Jul-09 22:28 
QuestionCrystalReports Pin
CodingYoshi17-Jul-09 7:06
CodingYoshi17-Jul-09 7:06 
AnswerRe: CrystalReports Pin
Adam R Harris17-Jul-09 9:20
Adam R Harris17-Jul-09 9:20 
GeneralRe: CrystalReports Pin
Adam R Harris17-Jul-09 10:41
Adam R Harris17-Jul-09 10:41 
GeneralRe: CrystalReports Pin
CodingYoshi17-Jul-09 10:54
CodingYoshi17-Jul-09 10:54 
QuestionCommon components in C# and .net? Pin
saxisa17-Jul-09 7:01
saxisa17-Jul-09 7:01 
QuestionNTLM Authentication in C# Pin
joana.simoes17-Jul-09 5:39
joana.simoes17-Jul-09 5:39 
AnswerRe: NTLM Authentication in C# Pin
Adam R Harris17-Jul-09 9:25
Adam R Harris17-Jul-09 9:25 
GeneralRe: NTLM Authentication in C# Pin
joana.simoes19-Jul-09 23:34
joana.simoes19-Jul-09 23:34 
Hi, Thanks for the reply.
I did a little bit of more research on this, and found out that the request, when fired from IE has a successfull http Ok response. These are the headers send by client and server during the negotiation:


GET /ogcservice/wmts.impl?service=wmts&request=getcapabilities&version=1.0.0 HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, application/x-shockwave-flash, */*
Accept-Language: en-gb
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
Accept-Encoding: gzip, deflate
Host: localhost:4326
Connection: Keep-Alive

HTTP/1.1 401 UNAUTHORIZED
Content-Length: 25
Content-Type: text/plain; charset=UTF-8
Server: GeognoSIS/7.1.135.0 (Alpha)
WWW-Authenticate: Negotiate
X-Cadcorp-GeognoSIS-Licence: {"Vendor Information":"Debug-only unlicensed version"}

2.39s
GET /ogcservice/wmts.impl?service=wmts&request=getcapabilities&version=1.0.0 HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, application/x-shockwave-flash, */*
Accept-Language: en-gb
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
Accept-Encoding: gzip, deflate
Host: localhost:4326
Connection: Keep-Alive
Authorization: Negotiate TlRMTVNTUAABAAAAl7II4gMAAwAuAAAABgAGACgAAAAGAHEXAAAAD0RFVjMwOURFVg==

HTTP/1.1 401 UNAUTHORIZED
Content-Length: 25
Content-Type: text/plain; charset=UTF-8
Server: GeognoSIS/7.1.135.0 (Alpha)
WWW-Authenticate: Negotiate TlRMTVNTUAACAAAABgAGADgAAAAVwoniTAEcDtTrdXk4jgACAAAAAJYAlgA+AAAABgBxFwAAAA9EAEUAVgACAAYARABFAFYAAQAMAEQARQBWADMAMAA5AAQAHgBEAGUAdgAuAGMAYQBkAGMAbwByAHAALgBuAGUAdAADACwARABFAFYAMwAwADkALgBEAGUAdgAuAGMAYQBkAGMAbwByAHAALgBuAGUAdAAFABYAYwBhAGQAYwBvAHIAcAAuAG4AZQB0AAcACAAa39zYFwnKAQAAAAA
X-Cadcorp-GeognoSIS-Licence: {"Vendor Information":"Debug-only unlicensed version"}

0.52s
GET /ogcservice/wmts.impl?service=wmts&request=getcapabilities&version=1.0.0 HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, application/x-shockwave-flash, */*
Accept-Language: en-gb
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
Accept-Encoding: gzip, deflate
Host: localhost:4326
Connection: Keep-Alive
Authorization: Negotiate TlRMTVNTUAADAAAAAAAAAFgAAAAAAAAAWAAAAAAAAABYAAAAAAAAAFgAAAAAAAAAWAAAAAAAAABYAAAAFcKI4gYAcRcAAAAP72lchzWm+/iEd8x2wP9Nsw==

 9:55:36 (5656): Req-URI: /ogcservice/wmts.impl?service=wmts&request=getcapabilities&version=1.0.0
AbstractCapabilities::Execute - Optional parameter 'Formats' received and ignored.First-chance exception at 0x770142eb in Cadcorp.GeognoSIS.exe: Microsoft C++ exception: _com_error at memory location 0x073ad100..
HTTP/1.1 200 OK
Content-Encoding: deflate
Content-Length: 8610
Content-Type: text/xml
Server: GeognoSIS/7.1.135.0 (Alpha)
X-Cadcorp-GeognoSIS-Licence: {"Vendor Information":"Debug-only unlicensed version"}


So, I tried to reproduce these headers in the C# app. I did something like this:

webRequest = WebRequest.Create(url);

webRequest.Credentials = CredentialCache.DefaultCredentials;
((HttpWebRequest)webRequest).UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)";
((HttpWebRequest)webRequest).Accept="text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
((HttpWebRequest)webRequest).KeepAlive = true;
((HttpWebRequest)webRequest).Headers["Accept-Encoding"] = "gzip,deflate";
((HttpWebRequest)webRequest).Headers["Accept-Charset"] = "ISO-8859-1,utf-8;q=0.7,*;q=0.7";

webRequest.PreAuthenticate = true;
webResponse = webRequest.GetResponse();
doc.Load(webResponse.GetResponseStream());


The webresponse is not empty, but I cannot see anywhere the username and password of the current user, but I guess this is ok? I dont have this username and password in my hand, and this is the reason why I am using the defaultCredentials, in the first place...
The negotiation process gets interrupted on step 2 of the process with a "System.FormatException: Invalid length for a Base-64 char array." error.
These are the headers of the negotiation process between the server and the C# app:

GET /ogcservice/wmts.impl?service=wmts&request=getcapabilities&version=1.0.0 HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Host: localhost:4326

HTTP/1.1 401 UNAUTHORIZED
Content-Length: 25
Content-Type: text/plain; charset=UTF-8
Server: GeognoSIS/7.1.135.0 (Alpha)
WWW-Authenticate: Negotiate
X-Cadcorp-GeognoSIS-Licence: {"Vendor Information":"Debug-only unlicensed version"}

1.09s
GET /ogcservice/wmts.impl?service=wmts&request=getcapabilities&version=1.0.0 HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Authorization: Negotiate TlRMTVNTUAABAAAAt7II4gMAAwAuAAAABgAGACgAAAAGAHEXAAAAD0RFVjMwOURFVg==
Host: localhost:4326

HTTP/1.1 401 UNAUTHORIZED
Content-Length: 25
Content-Type: text/plain; charset=UTF-8
Server: GeognoSIS/7.1.135.0 (Alpha)
WWW-Authenticate: Negotiate TlRMTVNTUAACAAAABgAGADgAAAA1woni33R9x/Rrb/E4jgACAAAAAJYAlgA+AAAABgBxFwAAAA9EAEUAVgACAAYARABFAFYAAQAMAEQARQBWADMAMAA5AAQAHgBEAGUAdgAuAGMAYQBkAGMAbwByAHAALgBuAGUAdAADACwARABFAFYAMwAwADkALgBEAGUAdgAuAGMAYQBkAGMAbwByAHAALgBuAGUAdAAFABYAYwBhAGQAYwBvAHIAcAAuAG4AZQB0AAcACACto1cBGwnKAQAAAAA
X-Cadcorp-GeognoSIS-Licence: {"Vendor Information":"Debug-only unlicensed version"}


They seem pretty similar to the ones that are sent by IE, except at this point I get an error:

0.56s
A first chance exception of type 'System.FormatException' occurred in System.dll
A first chance exception of type 'System.FormatException' occurred in System.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
The thread 'Win32 Thread' (0x13d0) has exited with code 0 (0x0).
A first chance exception of type 'System.ObjectDisposedException' occurred in System.dll
A first chance exception of type 'System.ObjectDisposedException' occurred in System.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
System.Net.WebException: The request was aborted: The request was canceled. ---> System.FormatException: Invalid length for a Base-64 char array.
   at System.Convert.FromBase64String(String s)
   at System.Net.NTAuthentication.GetOutgoingBlob(String incomingBlob)
   at System.Net.NegotiateClient.DoAuthenticate(String challenge, WebRequest webRequest, ICredentials credentials, Boolean preAuthenticate)
   at System.Net.NegotiateClient.Authenticate(String challenge, WebRequest webRequest, ICredentials credentials)
   at System.Net.AuthenticationManager.Authenticate(String challenge, WebRequest request, ICredentials credentials)
   at System.Net.AuthenticationState.AttemptAuthenticate(HttpWebRequest httpWebRequest, ICredentials authInfo)
   at System.Net.HttpWebRequest.CheckResubmitForAuth()
   at System.Net.HttpWebRequest.CheckResubmit(Exception& e)
   at System.Net.HttpWebRequest.DoSubmitRequestProcessing(Exception& exception)
   at System.Net.HttpWebRequest.ProcessResponse()
   at System.Net.HttpWebRequest.SetResponse(CoreResponseData coreResponseData)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetResponse()
   at Cadcorp.GeognoSIS.Manager.NodeMiscServicesGMaps.SetupChildren() in F:\V71\SIS\Tools\GeognoSISManager\NodeMiscServicesGMaps.cs:line 140
The thread '_threadstartex' (0x108c) has exited with code 0 (0x0).


Does anybody has any ideas about this? Any help would be much appreciated!
best regards,
Jo

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.