?? disk_class.vb
字號(hào):
Imports System.web
Public Class Disk_Class
Public Function getParentDirectory()
' this function works for /main/db/test/ as well as /main/db/test.aspx
System.Web.HttpContext(context = System.Web.HttpContext.Current)
Dim path As String = context.Session("Path").ToString()
If path = "./" Then
Return "../" ' trivial, no string manipulation required
ElseIf path = "/" Then
Return "/" ' can't go higher than root
Else
' remove trailing "/" at end of path
If path.LastIndexOf("/") = path.Length - 1 Then
path = path.Remove(path.LastIndexOf("/"), (path.Length - path.LastIndexOf("/")))
Try
'remove the characters after the last occurence of / in the string. => parent directory
path = path.Remove(path.LastIndexOf("/"), (path.Length - path.LastIndexOf("/")))
Return path + "/"
catch System.ArgumentOutOfRangeException(ex)
Return "/" 'default to root
End Try
End If
End If
End Function
Public Function ReportError(ByVal problem As String, ByVal tech As String, ByVal suggestion As String)
' outputs error, in english, and in tech, and with any suggestions.
System.Web.HttpContext(context = System.Web.HttpContext.Current)
Dim output As String = "<font color=red><BIG>Problem:</BIG> " + problem + "</font><hr>"
output += "Suggestion: " + suggestion + "<hr>"
output += "<small>Technical details: " + tech + "</small><hr>"
context.Response.Write(output)
End Function
End Class
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -