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/>
<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