Kelly's profileKelly's ChroniclesPhotosBlogListsMore ![]() | Help |
Kelly's ChroniclesThe life and times of a .NET Geek |
|||||
|
June 02 Kelly Martens: Troubled TimesDue to some recent tragic events, Kelly Martens will be unable to update this blog for an undetermined amount of time in the foreseable future. If you would like more details, please send a message to Kelly on Windows Live or Facebook or comment here. I will let him know you inquired, and if he confirms it is ok to share information with you, I will get in touch with you. In any case, please pray for Kelly as this is one of the darkest periods of his life. Thank you. May 05 POST and HTTP Protocol Violation Resolution in vb.netGood Morning! My daughter played volleyball last night and was once again outstanding. MY eldest daughter has been released. Unfortunately that has not gone so well. She is moving out of our house no later than next Monday and to be honest I am ok with that. Today’s topic is one that has plagued me for a while and isn’t really a coded solution but a hack. I thought I would share it in case some of you run into the same problem. Basically we want to POST data to the server, and the server saves the file and its response is a tar archive. Making the request works fine. Where I ran into trouble was the saving of the binary response to a variable and eventually a file. First some of the code to give you an idea of what happened: ' Download a single binary file from a server and save it to a local folder ' The post data template Dim PostdataArray As Byte() = Encoding.ASCII.GetBytes(Postdata) ' Create a new NetworkCredential object Try ' Set Preauthenticate property to true ' Associate the NetworkCrbedential object with the 'WebRequest' object ' Add required HTTP headers to request ' UploadData method implicitly sets HTTP POST as the request method Catch Ex As Exception End Try I get an exception when saving the response as a byte: Error: The underlying connection was closed: The server committed an HTTP protocol violation. The problem was that the .NET Framework detected the server did not comply with HTTP 1.1 RFC. This problem may occur when the response contains incorrect headers or incorrect header delimiters.
S0 what to do? I don’t have control of the production server so I can’t fix it on that end. So here is where the hack came in. I modified the app.exe.config file in the following way. You can also modify the machine.config file this way but don’t do that.I should note that I know that the server inserting a header with no name or value is against RFC2616. But I don't have the ability to modify the server's response in the production environment. Make it a great day! ------------------------------------------------------------------
DownloadAndSaveFile,Filename,User,Pass,Integer,template,PostdataTemplate,handler,PostdataArray,Byte,ASCII,GetBytes,Postdata,Create, WebClient,instance,Preauthenticate,True,Associate,NetworkCredential,WebRequest,Credentials,Headers,Accept,Content,Type, UploadData,method,exception,Catch,WriteLine,Error,Message,connection,.NET Framework,header,production,machine,environment,configuration,system,config April 29 Refresh Treeview From Another Form with vb.netGood Morning! Well Brett Favre is at it again. He has requested his release from the New York Jets but says he has no intentions of returning “at this time”. Is there any doubt he will be in a Vikings uniform once the season starts? I have just had it with him. The Vikings can have him. Today’s topic was requested last night. Basically the user wants to update the treeview on another form after the data is updated. Its not complicated. Basically we add an event handler to the original form that handles the update. On the calling form we call that event when the update occurs. Make it a great day!
Private Sub CallingForm_AfterUpdate(ByVal Sender As CallingForm, ByVal Item As Object) Dim nd As TreeNode nd = Me.SearchNodesForHierarchyItem(Me.mytreeview.Nodes, Item.ID) If Not nd Is Nothing Then End Sub Private Sub Refresh() Try Me.mytreeview.Nodes.Clear() If Me.cboTree.SelectedKey = 0 Then For Each h As Hierarchy In Hierarchy.TMHierarchies Dim n As New HierarchyNode(h.Name) n.ImageIndex = 0 If h.Children.Count > 0 Then n.Expand() Else Dim h As Hierarchy = New Hierarchy(CInt(Me.cboTree.SelectedKey)) Dim n As New HierarchyNode(h.Name) n.ImageIndex = 0 If h.Children.Count > 0 Then n.Expand() End If If Me.mytreeview.GetNodeCount(False) > 0 Then Me.mytreeview.SelectedNode = Me.mytreeview.Nodes(0) Catch ex As Exception End Try End Sub
and on the calling form simly call after an update: Public Event AfterUpdate(ByVal Sender As CallingForm, ByVal Item As Object) Object,TreeNode,Nodes,Text,Name,EnsureVisible,SelectedNode,SelectedKey,ImageIndex,SelectedImageIndex,Children,Count,Expand,GetNodeCount, Exception,Public,AfterUpdate April 27 Scroll Control Into View In Panel with vb.netGood Morning! This weekend was pretty busy. In addition to my side work and work on my current projects we had meetings with people about the formation of another band, and making plans to do some work on my house this summer. Today’s topic was asked of me and it can be a little frustrating I guess. Basically we want to scroll within a panel to a particular control within that panel and have that control come into view. Not complicated but it works. Make it a great day! Public Class Form1 Technorati Tags: vb.net,.NET Framework,csharp,Scroll,Control,Into,View,Panel,Name,sender,System,Object,MyBase,Load,Controls,TypeOf,GroupBox,Items, April 23 Format XML with vb.netGood Morning! Hope all is well in your neck of the woods. I play bass for a band tonight as well as hopefully getting to catch my daughter in a volleyball game. So today’s topic is how to format xml with vb.net. When I was grabbing and displaying the XML string, it came without line breaks and such which made it difficult to read. So my solution is here. It isn’t elegant or cute but it does work. Make it a great day! Private Function ParseXml(ByVal xml As String) As String Technorati Tags: vb.net,csharp,.NET Framework,XML,Format,builder,System,Text,StringBuilder,Replace,Trim,Split,Integer,length,IndexOf,AppendLine |
Public folders
Hey! Let me know you stopped by and if anything interested you! Thanks!
marcowrote:
Kelly,
I found this article of yours on the net and I was hoping it could help me building my program. http://kellychronicles.spaces.live.com/blog/cns!A0D71E1614E8DBF8!1469.entry I have a vb.net program with a Treeview on the main page (Explorer1). From a second form (frmZoeken) I want to update the Treeview on the main page but since I'm a newbie I don't understand the code in the article. I was hoping that maybe you could help me out. It would mean a great deal to me. maybe you will allow me to send you some code I have created? Marco Krechting The Netherlands
May 25
Barbarawrote:
Thank you for you very quick response to my note. It works now. Thanks
Mar. 4
Barbarawrote:
I was wondering if you are going to able to update this plugin to work with WLW 2K9? It crashes every time I run it....
Mar. 3
No namewrote:
hey! i love your tag generator addon for WLW, but i think it has problems with WLW 2009 release.. I wrote review on gallery.live.com... Would love if you could updte it :)
Jan. 23
Dev Parikhwrote:
Spaces seems to be up now :)
Dec. 3
|
||||
|
|