473,320 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how to determine the physical path of a page

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
Aug 18 '06 #1
4 1501
Did you try Request.PhysicalPath?

"Vaclav Jedlicka" <vj*******@atlas.czwrote in message
news:uL*************@TK2MSFTNGP05.phx.gbl...
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
Aug 18 '06 #2
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");


Aug 18 '06 #3
Request.PhysicalPath will give you what you want.

See a sample running at : http://asp.net.do/test/pathinfo.aspx

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Vaclav Jedlicka" <vj*******@atlas.czwrote in message news:uL*************@TK2MSFTNGP05.phx.gbl...
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


Aug 18 '06 #4
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.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Vaclav Jedlicka" <vj*******@atlas.czwrote in message
news:eE**************@TK2MSFTNGP06.phx.gbl...
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");

Aug 18 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Simon | last post by:
I wonder if someone can help with this - I 'm creating an IISVirtualDirectory, and setting its Path property to the physical path I want to reference. This works fine when I have a standard file...
9
by: Adam | last post by:
Can someone please help!! I am trying to figure out what a font is? Assume I am working with a fixed font say Courier 10 point font Question 1: What does this mean 10 point font Question 2:...
1
by: Igor | last post by:
hi, is it possible to retrive the physical path of a aspx page at design time? I create a MyPageBase inherited from System.Web.UI.Page class. MyPageBase have a property "PageFileName", that...
1
by: Michiel Schaeverbeke | last post by:
Hi, I'm trying to reach an xml file from within a web application. The file is physically on a different server. When I try to reach it using \\servername\path\ style, I get the error...
1
by: Raed Sawalha | last post by:
I have a problem in getting asp.net application physical path in global.ascx static function in my global.ascx i have a static function : first i tried to get the physical path by refelection...
9
by: dgk | last post by:
Is there some built in way to know whether a physical folder path is 'My Documents" for a specific user? I can always use xxx.StartsWith to compare it to the enumeration returned by the Personal...
8
by: Jaime Stuardo | last post by:
Hi all... How can I get the physical path of a web site from an EXE application? The Web Site is on the same server as the application. Thanks in advance Jaime
1
by: bilalmk | last post by:
may i get the physical path of any page hosted on other server
5
by: marss | last post by:
Server.MapPath("~/page.aspx") returns the physical file path based on the specified virtual path. Is there any reverse method to get the virtual path based on the physical path (both pathes belong...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.