开发者

access to File on Server

开发者 https://www.devze.com 2022-12-15 15:08 出处:网络
My web-appliction references to a file that\'s in the same maindirectory. Dim index_root As String = \"luceneindex\"

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消