Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. vb webclient and javascript

vb webclient and javascript

Scheduled Pinned Locked Moved Web Development
questioncsharpjavascriptdotnetagentic-ai
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Manuel F Hernandez
    wrote on last edited by
    #1

    I tried the VB board but maybe I'll have better luck here. :) I want to write a windows service application that reads a web page. That web page requires that the client can process javascript. Has anyone successfully implemented Javascript with System.Net.WebClient? I tried the code from the article "A simple .NET based WebClient with JavaScript support" but that code crashes with an inner JScriptException. Its acknowledged by the author and it looks like the trail ends there. According to microsoft the Microsoft.JScript.Vsa.VsaEngine used in that project is deprecated. What is the current working solution for processing webpages in code? This is what my code looks like. The web page at the URL I am calling uses javascript to set a cookie in order to prove that Javascript is running. It doesn't look like this code can do it. I can set cookies in advance but I can't seem to duplicate the javascipt setting a cookie. Help! Dim webClient As Net.WebClient = New System.Net.WebClient webClient.Credentials = System.Net.CredentialCache.DefaultCredentials webClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705") webClient.Headers.Add(Net.HttpRequestHeader.Cookie, "aCookie:aCokievalue") Try Dim data As Stream = webClient.OpenRead(sURL) Dim reader As New StreamReader(data) Dim s As String = reader.ReadToEnd() 'response = webClient.DownloadData(sURL) 'Return Encoding.ASCII.GetString(response) Return s Catch ex As Exception Return "" End Try

    P 1 Reply Last reply
    0
    • M Manuel F Hernandez

      I tried the VB board but maybe I'll have better luck here. :) I want to write a windows service application that reads a web page. That web page requires that the client can process javascript. Has anyone successfully implemented Javascript with System.Net.WebClient? I tried the code from the article "A simple .NET based WebClient with JavaScript support" but that code crashes with an inner JScriptException. Its acknowledged by the author and it looks like the trail ends there. According to microsoft the Microsoft.JScript.Vsa.VsaEngine used in that project is deprecated. What is the current working solution for processing webpages in code? This is what my code looks like. The web page at the URL I am calling uses javascript to set a cookie in order to prove that Javascript is running. It doesn't look like this code can do it. I can set cookies in advance but I can't seem to duplicate the javascipt setting a cookie. Help! Dim webClient As Net.WebClient = New System.Net.WebClient webClient.Credentials = System.Net.CredentialCache.DefaultCredentials webClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705") webClient.Headers.Add(Net.HttpRequestHeader.Cookie, "aCookie:aCokievalue") Try Dim data As Stream = webClient.OpenRead(sURL) Dim reader As New StreamReader(data) Dim s As String = reader.ReadToEnd() 'response = webClient.DownloadData(sURL) 'Return Encoding.ASCII.GetString(response) Return s Catch ex As Exception Return "" End Try

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      Could you use the JScriptCodeProvider[^] class for this?

      Deja View - the feeling that you've seen this post before.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups