Results 1 to 5 of 5

Thread: app.path equivalent in asp.net

  1. #1
    zchoyt
    Guest

    app.path equivalent in asp.net

    application.startuppath works in vb.net, but it is not there in asp.net. Anyone got any ideas?

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    asp.net should be like asp
    it automatically picks up the dir that your running your program from

    so just put "test.aspx"
    that should do it right

    *the above is just a guess*

  3. #3
    zchoyt
    Guest
    Good idea, but that does not work in .net. That will put it in the windows\system32 folder.

    Thanks for the reply though.

  4. #4
    zchoyt
    Guest
    you can add a referance to system.windows.forms which is the namespace where application.startupdir is located, but it does not work (maybe because an asp page is not an exe!). It gives the path to some strange location in the .net dll stuff

  5. #5
    Addicted Member Dmyze's Avatar
    Join Date
    Mar 2002
    Location
    Seattle
    Posts
    160
    I don't know that this will work in asp.net, but the proper replacement for app.path in VB.NET is System.Reflection.Assembly.GetExecutingAssembly.Location()

    (This will return the File Name of your exe at the end)

    Code:
        Dim sPath As String
    
        sPath = System.Reflection.Assembly.GetExecutingAssembly.Location()

    I use this to find the folder:

    Code:
        Dim oPath As System.IO.Path
        Dim sPath As String
    
        sPath = System.Reflection.Assembly.GetExecutingAssembly.Location()
        sPath = oPath.GetDirectoryName(sPath)
    -Daryl
    "Two More Rolls of Duct tape, and the world is mine!"
    VB.NET Guru

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width