how to determine the physical path of a page

V

Vaclav Jedlicka

Hello,

I created a web app using Visual Web Developer 2005 Express Edition. The
project is called "mytest".

When I view a page in the browser, its URL looks like

http://localhost:3415/myTest/SomePage.aspx

I need top determine the physical path of the page. I call

string ls_path = HttpContext.Current.Server.MapPath("/SomePage.aspx);

I get an error, because the "myTest" part is missing there. When I call

string ls_path = HttpContext.Current.Server.MapPath("/myTest/SomePage.aspx);

It works ok, but i do not want to do that, because on the production server
there will be no "myTest".

It will be something like

http://some_domain/SomePage.aspx

What can I do?


Thank you
Vaclav
 
S

Siva M

Did you try Request.PhysicalPath?

Hello,

I created a web app using Visual Web Developer 2005 Express Edition. The
project is called "mytest".

When I view a page in the browser, its URL looks like

http://localhost:3415/myTest/SomePage.aspx

I need top determine the physical path of the page. I call

string ls_path = HttpContext.Current.Server.MapPath("/SomePage.aspx);

I get an error, because the "myTest" part is missing there. When I call

string ls_path = HttpContext.Current.Server.MapPath("/myTest/SomePage.aspx);

It works ok, but i do not want to do that, because on the production server
there will be no "myTest".

It will be something like

http://some_domain/SomePage.aspx

What can I do?


Thank you
Vaclav
 
V

Vaclav Jedlicka

Hello, thank you for your help!

I do not need to know the path of the current request. Tha was just an
example.

in fact, I need to know the path of a Luecene folder when Lucene full text
indices are stored. So the real code is:

string ls_path = HttpContext.Current.Server.MapPath("/Lucene");
 
J

Juan T. Llibre

You'll need to phrase your questions more precisely, Vaclav.

If you need to know the path of a folder, please say so.

Asking for the physical path of the page when what you
want is the path of a folder is confusing...and time-wasting.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top