tags:

views:

29

answers:

1

Hello, 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

A: 

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.

Computer Linguist
i never heard sometinh about System.getPrperty,how does this work with asp.net?
Tyzak
Sorry, I saw Lucene and immediately thought Java. I've added the the ASP.NET code.
Computer Linguist