Get Current path of the project using Reflection in vb.net

Karthikanbarasan
Posted by Karthikanbarasan under VB.NET category on | Points: 40 | Views : 5583
Private Function GetCurrentPath() As String
Dim strPath As String = System.Reflection.Assembly.GetExecutingAssembly.Location
Dim n As Integer = InStrRev(strPath, "\")
If (n > 0) Then
strPath = Mid(strPath, 1, n)
End If
Return strPath
End Function

Comments or Responses

Posted by: Karaniscool on: 1/31/2011 Level:Starter | Status: [Member] | Points: 10

Can you provide the code in C# version.
Posted by: Karaniscool on: 1/31/2011 Level:Starter | Status: [Member] | Points: 10

I got it..
Response.Write(System.IO.Path.GetFileName(System.Reflection.Assembly.GetExecutingAssembly().Location));

Login to post response