Get the email in the Web page

Source: Internet
Author: User

 Private voidButton1_Click (Objectsender, EventArgs e)//Click to get web Mail        {            if(TextBox1.Text.Trim ()! ="") {HttpWebRequest Wrst= (HttpWebRequest) webrequest.create (TextBox1.Text);//create a request for access to the Web content (source code) (text box 1 input URL)HttpWebResponse wrpse = (httpwebresponse) wrst. GetResponse ();//Feedback Web RequestStream s = wrpse. GetResponseStream ();//Stream feedback information into streamStreamReader sr =NewStreamReader (S, Encoding.default);//Store the contents of stream in Encoding.default encoded in the second flow SR                stringx = Sr. ReadToEnd ();//define a variable x to receive Web page source code//MatchCollection applies the regular expression pattern to the set of successful matches found by the input string by replacing the constantMatchCollection MC = regex.matches (x,@"[a-za-z0-9_\-\.] [Email protected]\w+ (\.\w+) +");//The source code is stored in the Zone collection MC by the mailbox regular match .StringBuilder SB =NewStringBuilder ();//represents a mutable string                foreach(Match minchOck//Start Traversal{sb. Appendline (m.value);//find a match and integrate (designators the found word into SB) append attach} TextBox2.Text=sb.            ToString (); }            Else{MessageBox.Show ("Please enter the correct URL"); }        }

Save As

 private  void  Save As ToolStripMenuItem            _click (object   sender, EventArgs e) { Savefiledialog1.filter  =   text file |*.txt             ;            DialogResult Dr  = Savefiledialog1.showdialog ();                 if  (Dr==dialogresult.ok) {                 string  file = Savefiledialog1.filename; StreamWriter SW  = new   StreamWriter (f                ILE); Sw.                Write (TextBox2.Text); Sw.            Close (); }        }

Get the email in the Web page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.