C # According to the URL to get the domain name, directory name, file name function

Source: Internet
Author: User
Tags ftp iis save file domain
function | file name

#region get the function of domain name, directory, file name in the URL

public string Geturldomainname (string strhtmlpagepath)
{
String p = @ "http://[^\.] *\. (? <domain>[^/]*) ";
Regex reg = new regex (p,regexoptions.ignorecase);
Match m = Reg. Match (Strhtmlpagepath);
return m.groups["domain". Value;
}

Public string[] Geturlfolername (string strhtmlpagepath)
{
Crawl the file directory in the URL string

int at = 0;
int start = 0;
int notei=0;
int endi=0;
Int[] Myintarray =new int[10];
String[] Arrayfoldername=null;
String newfoldername;
while (Start < strhtmlpagepath.length) && (at >-1))
{
at = strhtmlpagepath.indexof ('/', start);
if (at = = 1) break;
Myintarray[notei]=at;
start = at+1;
Notei = notei+1;
Endi=at;
}
Arrayfoldername=new String[notei-1];
for (int i=0;i<notei;i++)
{
if (myintarray[i]>0)
{
if (myintarray[i+1]>0)
{
Newfoldername=strhtmlpagepath.substring (myintarray[i]+1,myintarray[i+1]-myintarray[i]-1);
Arrayfoldername.setvalue (Newfoldername,i);
}

}
}
return arrayfoldername;
}

public string Geturlfilename (string strhtmlpagepath)
{
Crawl the file name in the URL string
int at = 0;
int start = 0;
int notei=0;
int endi=0;
int[] Myintarray = new INT[10];
String C # When downloading files, pop-up Select folder Save directory Code C # gets the corresponding IP address based on the computer name C # get all workgroup and machine names for network neighbors C # List all IIS sites and related site properties C # reads the site-related property code in IIS C # new site, delete site function code C # under the picture file to the local, c#,c# download, download pictures, download files, download functions C # According to the URL to get the domain name, directory name, file name function C # To obtain information about the local computer FTP Web site files to local C # code C # Pop-up when saving files select the folder you want to save class code with the new folder effect Code in C # that calls the corresponding application to open the file sequence Datasheet file export Execel file-local test succeeded C # New save file with code named by date time C # Two functions for crawling directories and filenames based on Web addresses C # download file functions C # code to download files with line Cheng parameters C # Control techniques and flaws for downloading files using threads asp.net installation using the OWC component to build execel steps Bulk crawl HTTP and email addresses in web code, IO, regular expressions, grab Web sourceName= "";
while (Start < strhtmlpagepath.length) && (at >-1))
{
at = strhtmlpagepath.indexof ('/', start);
if (at = = 1) break;
Myintarray[notei]=at;
start = at+1;
Notei = notei+1;
Endi=at;
}

for (int i=0;i<notei;i++)
{
if (myintarray[i]>0)
{
if (myintarray[i+1]==0)
{
C # When downloading files, pop-up Select folder Save directory Code C # gets the corresponding IP address based on the computer name C # get all workgroup and machine names for network neighbors C # List all IIS sites and related site properties C # reads the site-related property code in IIS C # new site, delete site function code C # under the picture file to the local, c#,c# download, download pictures, download files, download functions C # According to the URL to get the domain name, directory name, file name function C # To obtain information about the local computer FTP Web site files to local C # code C # Pop-up when saving files select the folder you want to save class code with the new folder effect Code in C # that calls the corresponding application to open the file sequence Datasheet file export Execel file-local test succeeded C # New save file with code named by date time C # Two functions for crawling directories and filenames based on Web addresses C # download file functions C # code to download files with line Cheng parameters C # Control techniques and flaws for downloading files using threads asp.net installation using the OWC component to build execel steps Bulk crawl HTTP and email addresses in web code, IO, regular expressions, grab Web sourceName=strhtmlpagepath.substring (myintarray[i]+1,strhtmlpagepath.length-myintarray[i]-1);

}
}
}
Return C # When downloading files, pop-up Select folder Save directory Code C # gets the corresponding IP address based on the computer name C # get all workgroup and machine names for network neighbors C # List all IIS sites and related site properties C # reads the site-related property code in IIS C # new site, delete site function code C # under the picture file to the local, c#,c# download, download pictures, download files, download functions C # According to the URL to get the domain name, directory name, file name function C # To obtain information about the local computer FTP Web site files to local C # code C # Pop-up when saving files select the folder you want to save class code with the new folder effect Code in C # that calls the corresponding application to open the file sequence Datasheet file export Execel file-local test succeeded C # New save file with code named by date time C # Two functions for crawling directories and filenames based on Web addresses C # download file functions C # code to download files with line Cheng parameters C # Control techniques and flaws for downloading files using threads asp.net installation using the OWC component to build execel steps Bulk crawl HTTP and email addresses in web code, IO, regular expressions, grab Web sourceName.tolower ();

}

#endregion




Related Article

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.