Solved

ASP.NET/VB: HttpWebRequest without errors

Posted on 2013-11-06
1
289 Views
Last Modified: 2013-11-06
What am I doing wrong?
<%@ Page Language="VB" %>
<%

 Dim request = HttpWebRequest.Create("http://www.example.com")
 Dim response = request.GetResponse()
 Response.write(response)

%>

Open in new window

0
Comment
Question by:hankknight
1 Comment
 
LVL 15

Accepted Solution

by:
pateljitu earned 500 total points
ID: 39628798
Please try this code change:

 <%
        Dim request = System.Net.HttpWebRequest.Create("http://www.example.com")
        Dim Objresponse = request.GetResponse()
        
        
        Dim webStream As System.IO.Stream = Objresponse.GetResponseStream() ' Get Response

        Dim reader As New System.IO.StreamReader(webStream)
        ' Read the content.
        Dim responseFromServer As String = reader.ReadToEnd()
        
        Response.Write(responseFromServer.ToString())

       Response.Write(Server.HtmlEncode(responseFromServer.ToString()))  ' Raw HTML
        %>

Open in new window

0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question