Jump to content
Xtreme .Net Talk

ccc

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by ccc

  1. I don't know if anyone else has run into this, but if your using a webclient, or webrequest, and you goto a site with an expired/invalid SSL certificate it will error. Example: Dim webreq As New Net.WebClient(), by() As Byte by = webreq.DownloadData("https://paypal.com/i") 'Errors because the cert was issued to 'www.paypal.com' Debug.WriteLine(System.Text.Encoding.Default.GetString(by)) System.Net.WebClient webreq = new System.Net.WebClient(); byte[] by; by=webreq.DownloadData ("https://paypal.com/i"); // Errors because the cert was issued to 'www.paypal.com' System.Diagnostics.Debug.WriteLine (by); Gives me a good 'System.Net.WebException: The underlying connection was closed: Could not establish trust relationship with remote server.' Anyone know a work around (in vb or c#)? My connection must be secure (its not to paypal.com), I don't want to have to use a third party control for something that the net namespace can already do. Thanks in advance.
  2. ccc

    c header to net

    No one knows? Seems like a simple question for someone who knows a little c/c++
  3. What would this function header be if declared in vb.net? void LoadUp(LPVOID lpStart, int iStartLen, LPSTR strRes, int nResLen) I currently have: declare sub LoadUp .... (byval lpStart as int32, byval iStartLen as int32, byref strRes as string, byval nResLen as int32) Its a dll call, what im doing seems to error vb.net and my application just closes without any messages. Help would be appreciated. :-\
  4. ccc

    Searchi an array

    I may be stating the obvious, but make sure your string, is actually filled with something before you try calling ToUpper. Dim testStr As String MsgBox(testStr.ToUpper)'Would error Dim testStr As String = "" MsgBox(testStr.ToUpper)'Would not error Dim testStr As String MsgBox(UCase(testStr))'Would not error I stay away from using ToUpper, ToLower, Trim, Length of the string object because of this, and I use functions themselves. :eek:
  5. ccc

    ByVal, ByRef

    Thank you, that really cleared everything up for me.
  6. ccc

    ByVal, ByRef

    Okay, I know what byVal and byRef do, ByVal passes a copy of an object, and ByRef passes the actual object, but lets say I have this code: Class myTest Event myEvent(ByVal sender as myTest) sub FireEvent() RaiseEvent myEvent(me) end sub End Class sub RunTest() dim mTest as new myTest addhandler mTest.myEvent, addressof del_myEvent mTest.FireEvent end sub sub del_myEvent(byval sender as myTest) RemoveHandler sender.myEvent,addressof del_myevent end sub Will the object mTest's handler be unassigned correctly? Or since i've passed a copy of the object, the original will still fire again? Should I just stick to writing everything byref instead? My application seems to eat up alot of memory, because something is getting stuck and not used. It uses a similar structure to the code above. Any tips? Any help would be appreciated. Thanks. :confused:
  7. Does anyone know how to connect to a SOCKS proxy, and use it to establish a secure connection? I know how to establish a connection using the proxy, and I know how to establish a secure connection using the Net.WebClient class, but this class only allows for direct SSL sessions. I'm trying to download a secure webpage, any webpage, lets say for instance 'https://www.megaproxy.com' Anyone know? Would be greatly appreciated. Thanks in advance.
  8. Im having a weird https problem with vb.net. On my computer, this code runs perfectly fine (both segments), but on my partner's, who also has vb.net installed, both methods error with a nice: An unhandled exception of type 'System.Net.WebException' occurred in system.dll Additional information: The underlying connection was closed: The remote name could not be resolved. But if the codes (either) are standard http, it works fine for the both of us. I've haven't the slightest clue of whats going on. Any help would be greatly appreciated this has stopped development dead in its tracks. Example code is below. Dim url As String url = "https://www.megaproxy.com" 'https always errors, http doesn't 'Method 1 Dim wr As System.Net.WebRequest wr = System.Net.WebRequest.Create(url) Dim st As IO.StreamReader = New IO.StreamReader(wr.GetResponse.GetResponseStream) MsgBox(st.ReadToEnd) 'Method 2 Dim wb As New Net.WebClient(), b() As Byte b = wb.DownloadData(url) MsgBox(System.Text.Encoding.Default.GetString(b)) Thanks
×
×
  • Create New...