Image of the remote site
Hello guys!
I need your help.
This is code of my net page (C#).
I don't have error but in the output of webpage I don't see the image of the remote site, but I see an icon undefined...
How can i do it?
Can someone test my code?
please
Any help?
Thank you.
PHP Code:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="CallRemote_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Literal ID="Literal1" runat="server" Mode="passthrough">
<img alt="" src="<img alt="" src="http://www.meteowebcam.it/export_reg.php?reg=Toscana&day=0"/>"/></asp:Literal>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.IO;
public partial class CallRemote_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Literal1.Text = getHtml("http://www.meteowebcam.it/export_reg.php?reg=Toscana&day=0");
}
public string getHtml(string url)
{
try
{
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
myRequest.Method = "GET";
WebResponse myResponse = myRequest.GetResponse();
StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8);
string result = sr.ReadToEnd();
sr.Close();
myResponse.Close();
return result;
}
catch (Exception exception)
{
return "The following error occurred: " + exception;
}
}
}



Reply With Quote
Bookmarks