This article is based on a picture of the URL address, save the picture to the ASP.net server side of the implementation method.
Create the Getimage.aspx page with the following code:
<%@ Page language= "C #" autoeventwireup= true "codebehind=" GetImage.aspx.cs "inherits=" KeleyiTestWeb.KImage.GetImage "%> <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
The code for GetImage.aspx.cs is as follows:
/* Reference: http://keleyi.com/a/bjac/qwcsgskp.htm
* *
using System;
Using Keleyi.KFrame.KImage;
Namespace Keleyitestweb.kimage
{public
partial class GetImage:System.Web.UI.Page
{
protected void Page_Load (object sender, EventArgs e)
{
}
protected void Btnsave_click (object sender, EventArgs e)
{
String m_filename = DateTime.Now.ToFileTime (). ToString () + ". jpg";
String m_savename = "download/" + m_filename;
String m_savepath = Server.MapPath (m_savename);
if (Keleyiimgdownloader.downloadpicture (Tbpicurl.text, M_savepath,-1))
{
Ltltips.text = "Get Success";
Imgdownload.imageurl = M_savename;
}
else
Ltltips.text = "Get Failed";}}}
Here use the class Keleyiimgdownloader, set up in the Kframe project, code please download the project source (URL: https://kws.codeplex.com/SourceControl/changeset/ 610506BB3AB2B79EBF0D797C0F15939636FF76B3).
Run, enter the image URL, click the "Save" button, success, the effect of the chart is as follows:
View the source code of the page and see the src attribute of the picture:
The picture shown on the page is on the server where the program resides.
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.