خوب اگه کد ِ خاصی این error رو میده کد رو بگذارین
واسه من اینه
کد:
Imports System.IO
Imports System
Imports System.IO.DirectoryInfo
Imports System.Collections
Imports System.Web.UI.WebControls
Imports System.FormatException
Partial Class Admin_Addfile
Inherits System.Web.UI.Page
Dim path As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim nrow As TableRow
Dim ncell, ncell2, ncell3, ncell4, ncell5 As TableCell
Dim hyper1 As HyperLink
Dim lbl1, lbl2, lbl3 As Label
Dim lastaccess As String
Dim files As String
Dim atr As String
Dim dirs As DirectoryInfo()
Dim dir As DirectoryInfo
Dim chl As CheckBoxList
Dim query As String = Request.QueryString("dir")
If query Is Nothing Then
path = "\"
Else
path = query
End If
Label1.Text = "Enter Directory To Delete : " & path
Label4.Text = "Enter Directory Name To Create : " & path
Dim di As New DirectoryInfo(path)
dirs = di.GetDirectories
ncell = New TableCell()
nrow = New TableRow()
hyper1 = New HyperLink
hyper1.Text = "Up One Level"
If path Is Directory.GetDirectoryRoot(path) Then
Else
hyper1.NavigateUrl = "Manage.aspx?dir=" & Directory.GetParent(path).ToString()
End If
ncell.Controls.Add(hyper1)
nrow.Cells.Add(ncell)
tbl.Rows.Add(nrow)
For Each dir In dirs
'List Sub Directories
nrow = New TableRow()
ncell = New TableCell()
ncell2 = New TableCell()
ncell3 = New TableCell()
ncell4 = New TableCell()
ncell5 = New TableCell()
hyper1 = New HyperLink
hyper1.Text = "\" & dir.Name
hyper1.NavigateUrl = "Manage.aspx?dir=" & dir.FullName
ncell.Controls.Add(hyper1)
nrow.Cells.Add(ncell)
tbl.Rows.Add(nrow)
'File siz
lbl1 = New Label
lbl1.Text = ""
ncell2.Controls.Add(lbl1)
nrow.Cells.Add(ncell2)
tbl.Rows.Add(nrow)
'Files Count
files = dir.GetFiles.Length
lbl1 = New Label
lbl1.Text = files
ncell3.Controls.Add(lbl1)
nrow.Cells.Add(ncell3)
tbl.Rows.Add(nrow)
'Attributes
atr = dir.CreationTime
lbl2 = New Label
lbl2.Text = atr
ncell4.Controls.Add(lbl2)
nrow.Cells.Add(ncell4)
tbl.Rows.Add(nrow)
'Last Access Time
lastaccess = dir.LastAccessTime
lbl3 = New Label
lbl3.Text = lastaccess
ncell5.Controls.Add(lbl3)
nrow.Cells.Add(ncell5)
tbl.Rows.Add(nrow)
Next
Dim fileslist As FileInfo()
Dim f As FileInfo
fileslist = di.GetFiles
For Each f In fileslist
'List Files
nrow = New TableRow()
ncell = New TableCell()
ncell2 = New TableCell()
ncell3 = New TableCell()
ncell4 = New TableCell()
ncell5 = New TableCell()
lbl1 = New Label
lbl1.Text = f.Name
ncell.Controls.Add(lbl1)
nrow.Cells.Add(ncell)
tbl.Rows.Add(nrow)
'File Size
lbl1 = New Label
lbl1.Text = f.Length() & " Bytes"
ncell2.Controls.Add(lbl1)
nrow.Cells.Add(ncell2)
tbl.Rows.Add(nrow)
'Files Count
lbl1 = New Label
lbl1.Text = ""
ncell3.Controls.Add(lbl1)
nrow.Cells.Add(ncell3)
tbl.Rows.Add(nrow)
'Date Created
atr = f.CreationTime
lbl2 = New Label
lbl2.Text = atr
ncell4.Controls.Add(lbl2)
nrow.Cells.Add(ncell4)
tbl.Rows.Add(nrow)
'Last Access Time
lastaccess = f.LastAccessTime
lbl3 = New Label
lbl3.Text = lastaccess
ncell5.Controls.Add(lbl3)
nrow.Cells.Add(ncell5)
tbl.Rows.Add(nrow)
Next
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim parent As String = Directory.GetParent(path).ToString
Dim msg As String
Dim title As String
Dim style As MsgBoxStyle
Dim response1 As MsgBoxResult
msg = "You Will Lost All Directories And Files In This Directory , Are You Sure?" ' Define message.
style = MsgBoxStyle.YesNo
title = "Are You Sure?" ' Define title.
' Display message.
response1 = MsgBox(msg, style, title)
If response1 = MsgBoxResult.Yes Then ' User chose Yes.
Directory.Delete(path, True)
Response.Redirect("Manage.aspx?dir=" & parent)
End If
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
If tfile.Text = "" Or tfile.Text = "\" Then
lerrorf.Text = "Please Enter File Name"
Exit Sub
End If
Dim parent As String = Directory.GetParent(path).ToString
Dim msg As String
Dim title As String
Dim style As MsgBoxStyle
Dim response1 As MsgBoxResult
msg = "Are You Sure?" ' Define message.
style = MsgBoxStyle.YesNo
title = "Are You Sure?" ' Define title.
' Display message.
response1 = MsgBox(msg, style, title)
Dim exist As String = File.Exists(path & "\" & tfile.Text)
If exist = "True" Then
If response1 = MsgBoxResult.Yes Then ' User chose Yes.
File.Delete(path & "\" & tfile.Text)
Response.Redirect("Manage.aspx?dir=" & path)
End If
Else
lerrorf.Text = "Sorry , File Does Not Exist"
End If
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
If tdir.Text = "" Or tdir.Text = "\" Then
lerrord.Text = "Please Enter Directory"
Exit Sub
End If
Dim parent As String = Directory.GetParent(path).ToString
Dim exist As String = Directory.Exists(path & "\" & tdir.Text)
lerrord.Text = exist
Dim msg As String
Dim title As String
Dim style As MsgBoxStyle
Dim response1 As MsgBoxResult
msg = "You Will Lost All Directories And Files In This Directory , Are You Sure?" ' Define message.
style = MsgBoxStyle.YesNo
title = "Are You Sure?" ' Define title.
' Display message.
response1 = MsgBox(msg, style, title)
If response1 = MsgBoxResult.Yes Then ' User chose Yes.
If exist = "True" Then
Directory.Delete(path & "\" & tdir.Text, True)
Response.Redirect("Manage.aspx?dir=" & path)
Else
lerrord.Text = "Sorry , Directory Does Not Exist"
End If
End If
End Sub
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim exist As String = Directory.Exists(path & "\" & tdc.Text)
If exist = "False" Then
Directory.CreateDirectory(path & "\" & tdc.Text)
Response.Redirect("Manage.aspx?dir=" & path)
Else
lerrordc.Text = "Sorry , Directory Exist Already"
End If
End Sub
Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click
Response.Redirect("Upload.aspx?where=" & path)
End Sub
End Class