asp.net 2.0 and C #. NET Create a directory tutorial

Source: Internet
Author: User
Tags hosting hosting companies web hosting web hosting companies

This tutorial will show you how to create a directory that uses ASP.net 2.0 and C # on disk. NET in

。 NET Framework provides many types that make access to resource files easy to use.
To write a simple directory of disks, we will first need to import System.IO namespaces. The System.IO namespace contains the CreateDirectory () method, which we will use to build our catalog.

Imports System.IO

We used more than 10 web hosting companies before we found the server intelligence. Its dedicated servers and Plug-ins are installed quickly in less than 24 hours. We were able to confirm our order by telephone. They responded to our investigation within one hours. Server Smart customer support and assistance is the best we have ever experienced.

We will put our code btnSubmit_Click () event.

When the btnSubmit_Click () event executes its createdirectory () method, the specified directory name Txtdir.

protected void btnSubmit_Click (object sender, EventArgs e)
{

try {
Directory.CreateDirectory (MapPath (".") + "\" + Txtdir.text);
catch (Exception ex) {
Lblstatus.text = ex. message;
}

}

If you are looking for a good web hosting, please try server intelligence-we found the installer and Control Panel, it's easy to adapt and their I T team is scary!

We have a text box, a submit button and a label on the front end user interaction. Front. ASPX pages look like this:

<table width= "border=" 0 "align=" center "cellpadding=" 5 "cellspacing=" 1 "bgcolor=" #cccccc ">

<tr>
<TD width= "align=" "Right" bgcolor= "#eeeeee" class= "header1" > Directory to Create:</td>
<TD align= "center" bgcolor= "#FFFFFF" >
<asp:textbox id= "Txtdir" runat= "Server" ></asp:textbox><br/>
<asp:button id= "btnsubmit" runat= "Server" text= "Submit" onclick= "btnSubmit_Click"/><br/> &nbsp;
<asp:label id= "lblstatus" runat= "Server" >www.111cn.net</asp:label></td>
</tr>

</table>

Server intelligence assists, businesses of all sizes and their hosting needs, provide fully configured server solutions plus Active Server Management services. Server Intelligence specializes in providing complete Internet server solutions, ready to support their expert 365-24 active support team. The code-behind page for the

flow is as follows.

Using System;
using System.Data;
using System.Configuration;
using System.Web;
using system.web. security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;

Public partial class _default:system.web.ui.page
{

protected void Page_Load (object sender, EventArgs e)
{
}
protected void btnSubmit_Click (object sender, EventArgs e)
{
try {
Directory.CreateDirectory (MapPath (".") + "\" + Txtdir.text);
} catch (Exception ex) {
Lblstatus.text = ex. message;
}
}

}

Reprint please indicate www.111cn.net/net/net.html

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.