Click here to Skip to main content
15,886,199 members
Home / Discussions / C#
   

C#

 
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
GeneralRe: NTLM Authentication in C# Pin
joana.simoes19-Jul-09 23:50
joana.simoes19-Jul-09 23:50 
AnswerRe: NTLM Authentication in C# Pin
joana.simoes20-Jul-09 3:30
joana.simoes20-Jul-09 3:30 
QuestionRichTextBox- :(( Pin
RongNK17-Jul-09 4:49
RongNK17-Jul-09 4:49 
AnswerRe: RichTextBox- :(( Pin
Manas Bhardwaj17-Jul-09 4:59
professionalManas Bhardwaj17-Jul-09 4:59 
GeneralRe: RichTextBox- :(( Pin
RongNK17-Jul-09 5:04
RongNK17-Jul-09 5:04 
GeneralRe: RichTextBox- :(( Pin
Manas Bhardwaj17-Jul-09 5:14
professionalManas Bhardwaj17-Jul-09 5:14 
GeneralRe: RichTextBox- :(( Pin
RongNK17-Jul-09 5:39
RongNK17-Jul-09 5:39 
GeneralRe: RichTextBox- :(( Pin
DoctorMick17-Jul-09 6:19
DoctorMick17-Jul-09 6:19 
AnswerRe: RichTextBox- :(( Pin
Luc Pattyn17-Jul-09 10:07
sitebuilderLuc Pattyn17-Jul-09 10:07 
QuestionControl Timer is not work ?? Pin
anhhuynokia17-Jul-09 4:17
anhhuynokia17-Jul-09 4:17 
AnswerRe: Control Timer is not work ?? Pin
musefan17-Jul-09 4:25
musefan17-Jul-09 4:25 
AnswerRe: Control Timer is not work ?? Pin
ddecoy17-Jul-09 4:27
ddecoy17-Jul-09 4:27 
AnswerRe: Control Timer is not work ?? Pin
OriginalGriff17-Jul-09 4:27
mveOriginalGriff17-Jul-09 4:27 
AnswerRe: Control Timer is not work ?? Pin
Luc Pattyn17-Jul-09 10:29
sitebuilderLuc Pattyn17-Jul-09 10:29 
GeneralRe: Control Timer is not work ?? Pin
anhhuynokia17-Jul-09 18:06
anhhuynokia17-Jul-09 18:06 
Questionenumerate local group membership on a member server Pin
caiena17-Jul-09 3:55
caiena17-Jul-09 3:55 
QuestionText size in WebBrowser control Pin
Branislav Vidovic17-Jul-09 2:44
Branislav Vidovic17-Jul-09 2:44 

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.