how to determine the physical path of a page

  • Thread starter Thread starter Vaclav Jedlicka
  • Start date Start date
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
 
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
 
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");
 
Back
Top