public string GetComputerName(string clientIP) { try { var hostEntry = Dns.GetHostEntry(clientIP); return hostEntry.HostName; } catch (Exception ex) { return string.Empty; } }
protected void Button1_Click(object sender, EventArgs e) { lblIP.Text = GetComputerName(txtIP.Text); try { string myFolder = "MyFolderName"; string UNCpath = "\\" + lblIP.Text.Trim() +\\My_Shared\\; string fullPath = UNCpath + myFolder; Directory.CreateDirectory(fullPath);//'Create folder }
importing/using (depending on language) the System.IO namespace
string pathToCreate = "~/UserFolders/" + "NAME HERE"; if(Directory.Exists(Server.MapPath(pathToCreate)) { //In here, start looping and modify the path to create to add a number //until you get the value needed } //Now you know it is ok, create it Directory.CreateDirectory(Server.MapPath(pathToCreate));
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)