Solved

ASP.NET/VB: HttpWebRequest without errors

Posted on 2013-11-06
1
291 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

756 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