Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
Form1.cs
Package: Demo16xxx00.rar [view]
Upload User: jsz11269
Upload Date: 2017-01-14
Package Size: 450k
Code Size: 2k
Category:
Email Server
Development Platform:
C#
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Net;
- using System.IO;
- namespace UseWebClient
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void btnGet_Click(object sender, EventArgs e)
- {
- try
- {
- WebClient client = new WebClient();
- //client.BaseAddress = "shaozhd";
- Stream response = client.OpenRead(tbURL.Text);
- tbContent.Text = "";
- int nByteData;
- do
- {
- nByteData = response.ReadByte();
- if (nByteData > 0)
- tbContent.Text += Convert.ToChar(nByteData);
- } while (nByteData > 0);
- response.Close();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message.ToString());
- }
- }
- private void btnDownload_Click(object sender, EventArgs e)
- {
- try
- {
- WebClient client = new WebClient();
- FolderBrowserDialog dlg = new FolderBrowserDialog();
- if (dlg.ShowDialog() == DialogResult.OK)
- {
- string strDes = dlg.SelectedPath + Path.GetFileName(tbAddress.Text);
- client.DownloadFile(tbAddress.Text, strDes);
- MessageBox.Show("文件下载到:"+ strDes) ;
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message.ToString());
- }
- }
- }
- }