access to File on Server
My web-appliction references to a file that's in the same maindirectory.
Dim index_root As String = "luceneindex"
but when use declare a directory with the file
Dim directory As Lucene.Net.Store.Directory = FSDirectory.GetDirectory(index_root, False)
i get an error. i tried "\luceneindex", "\luceneindex", "\maindirectory\luceneindex", "\127.0.0.1\maindirectory\luceneindex" ,...
How do I use a file in the same directoy? I talked to the admin, he told me开发者_运维技巧 the setting are correct.
greetz, tyzak
For Java: You'll need to use System.getProperty("user.dir")
. This should give you a reference to the project folder.
For ASP.NET: You'll need to use Server.MapPath("~/" + folderAndFile)
. The tilde expands to the physical path of the application.
精彩评论