|
Just a thought, could be because your request is empty.
If at first you don't succeed ... post it on The Code Project and Pray.
|
|
|
|
|
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
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, *
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
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
|
|
|
|
|
Ok, I start to thing this has something to do with the formatting of the string that the server is sending to the C# client (or maybe some illegal characters?)
This is an accurate description of the places where I'm getting error in my app:
at System.Convert.FromBase64String(String s)\r\n
at System.Net.NTAuthentication.GetOutgoingBlob(String incomingBlob)\r\n
at System.Net.NegotiateClient.DoAuthenticate(String challenge, WebRequest webRequest, ICredentials credentials, Boolean preAuthenticate)\r\n
at System.Net.NegotiateClient.Authenticate(String challenge, WebRequest webRequest, ICredentials credentials)\r\n
at System.Net.AuthenticationManager.Authenticate(String challenge, WebRequest request, ICredentials credentials)\r\n
at System.Net.AuthenticationState.AttemptAuthenticate(HttpWebRequest httpWebRequest, ICredentials authInfo)\r\n
at System.Net.HttpWebRequest.CheckResubmitForAuth()\r\n
at System.Net.HttpWebRequest.CheckResubmit(Exception& e)\r\n
at System.Net.HttpWebRequest.DoSubmitRequestProcessing(Exception& exception)\r\n
at System.Net.HttpWebRequest.ProcessResponse()\r\n
at System.Net.HttpWebRequest.SetResponse(CoreResponseData coreResponseData)
Does anybody know a way of looking into this string that is causing problems?
cheers,
Jo
|
|
|
|
|
Problem sorted!
It turned out there was a problem in the server, and it was *indeed* sending an invalid length string...
|
|
|
|
|
In window Form : I want to identify the row and colum of edit cursor .when I use movement key or mouse click ,i still know position of cursor (row and colum) .So what to do that .
Sorry for my english !
|
|
|
|
|
Well, before even going into the details, can you tell us why do you whant to do that?
May be a alternative/simpler approach can help you.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I have 1 problem and i want to learn how to do that
|
|
|
|
|
This might give you a little idea:
private void richTextBox1_MouseHover(object sender, EventArgs e)
{
Point _location = richTextBox1.GetPositionFromCharIndex(richTextBox1.Text.Length - 1);
MessageBox.Show(string.Format("{0}, {1}",
_location.X,
_location.Y));
}
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Sorry , i want to identify the row and column of editing cursor .
for example : I paste a document to richtextbox end then i use "up key" or "down key" to move the edting cursor and then i know the position of editing cursor .
Please help me ! Sorry for my english.
|
|
|
|
|
Something like this would work but I doubt it is the best way to do it....
private void richTextBox1_KeyUp(object sender, KeyEventArgs e)
{
int totalLength = 0;
int line = 0;
int pos = 0;
for (int i = 0; i < richTextBox1.Lines.Length; i++)
{
if(i != 0) totalLength++;
totalLength += richTextBox1.Lines[i].Length;
if (totalLength >= richTextBox1.SelectionStart)
{
line = i + 1;
pos = richTextBox1.SelectionStart - (totalLength - richTextBox1.Lines[i].Length);
break;
}
}
label1.Text = "Line " + line.ToString() + "; Char " + pos.ToString();
}
|
|
|
|
|
Hi,
I haven't used it myself (I don't like RTB that much) but this looks like the right tool[^] for you.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Here the code programing network about receive message
<br />
private void Received(IAsyncResult iar)<br />
{<br />
NetworkStream ns = (NetworkStream)iar.AsyncState;<br />
int byteRead = ns.EndRead(iar);<br />
String sReply = Encoding.ASCII.GetString(m_byteData,0,byteRead);<br />
String sProtocol = sReply.Substring(0, 8);<br />
<br />
switch (sProtocol)<br />
{<br />
case "GETPRES ":<br />
if(timerSendMonitorDesktop.Enabled ==false)<br />
timerSendMonitorDesktop.Enabled = true; <br />
break;<br />
}<br />
}<br />
<br />
private void timerSendMonitorDesktop_Tick(object sender, EventArgs e)<br />
{<br />
MessageBox.Show("abc");<br />
}<br />
<br />
Help me!Thanks you
|
|
|
|
|
anhhuynokia wrote: Help me!
Help you do what exactly?
What issues are you having? what are you trying to do that dont work?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
What type is the timerSendMonitorDesktop ?
I know the System.Windows.Fomrs.Timer requires you to call the Timer.Start() method.
So try timerSendMonitorDesktop.Start()
|
|
|
|
|
When you say "is not work" what does happen?
Does the code reach the Recieved method at all?
If you put a breakpoint at "if(timerSend...", does the code reach it?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hi,
"is not work" doesn't tell us anything, we need hard facts in order to provide specific help.
Lacking that, one can only provide general advice, such as:
- learn how to debug
- improve the observability of your code, i.e. make visible what is going on. You can insert extra statements for that purpose, such as Console.WriteLine("I am here"); when running inside Visual Studio; or MessageBox.Show which I don't like because you only see one at a time, and don't get a historic summary.
Things to look for:
- is Received running at all?
- what is the value of byteRead?
- what is the value of sReply?
- what is the value of sProtocol?
Did you notice I covered your code top-down? The goal is to see which parts work fine, and what is the first statement that doesn't perform as you expect.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
public delegate void DisplayActionHandler();
public void StartTimer()
{
if (this.InvokeRequired)
{
// Invokes the timer restart from the timer thread.
this.Invoke(new DisplayActionHandler(StartTimer));
}
else
{
this.timer.Start();
}
}
public void StopTimer()
{
if (this.InvokeRequired)
{
// Invokes the timer restart from the timer thread.
this.Invoke(new DisplayActionHandler(StopTimer));
}
else
{
this.timer.Stop();
}
}
Use StopTimer() and StartTimer() instead of myTimer.Stop (or myTimer.Enabled = false).
If your timer was called from the other thread that the caller, the simple Stop/Start will not work, you will need to Invoke your stop/start from the thread in that the timer was created.
Thank Sergiu Dudnic
|
|
|
|
|
how can i enumerate all groups members in all groups on a member server
|
|
|
|
|
Hy guys!
I have a question about text size in WebBrowser control in MS Visual C# 2005 Express Edition. You know when you view web pages in a browser you can alter the overal text size from the contex menu. For example when I open MSDN help in C#, from the context menu i can choose the text size. I actually found out that this operation afects also my webbrowser control. So if i choose "Larger" text size when i am viewing MSDN, my webbrowser control will also change it's text size.
My question is: How can I control the text size in my webbrowser control? Is there a property or some way to do it?
Thank you for your time.
Cheers!
|
|
|
|
|
Just a thought,
I know you access to the DOM so you might be able to do this if you set the style on the body of the doument.
If at first you don't succeed ... post it on The Code Project and Pray.
|
|
|
|
|
I did a little looking for you and you can call WebBrowser.Document.InvokeScript to execute some script on the document.
So you could do something like this
webBrowser1.Document.InvokeScript("body.style.style.fontSize = '10pt';");
I'm not sure if you can directly execute javascript like that you might have to use a function.
You could always add your function to a page by appending the script to WebBrowser.Document.InnerHTML
InvokeScript(string) - MSDN[^]
OR if you want to create a function in your page to do the sizing and pass it parameters
InvokeScript(string, object)[^]
If at first you don't succeed ... post it on The Code Project and Pray.
|
|
|
|
|
Thank you, this was helpfull!
Cheers!
|
|
|
|
|
Yes, the WebBrowser Control uses the settings you defined while using Internet Explorer. It also shares a lot of code with IE.
For your own web pages, you can set all style attributes within your pages themselves, using either HTML, XHTML or better yet CSS.
For exisiting pages, I don't know if and how you can programmatically alter the IE settings (and I would not like an app that modifies how IE works without me asking it to do so). Well, actually I don't use IE that much, there are even better browsers around
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi,
In the list view i've couple of temporary items and they are staying at the bottom of the list, when i do sorting i dont want to include those two rows how to do that?
Thanks
|
|
|
|
|
Only way I know is to remove them, sort the list and then add them again, unless you inherit from the list view and provide your own custom enumeration.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|