PC Review


Reply
Thread Tools Rate Thread

how to determine the physical path of a page

 
 
Vaclav Jedlicka
Guest
Posts: n/a
 
      18th Aug 2006
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


 
Reply With Quote
 
 
 
 
Siva M
Guest
Posts: n/a
 
      18th Aug 2006
Did you try Request.PhysicalPath?

"Vaclav Jedlicka" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
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


 
Reply With Quote
 
Vaclav Jedlicka
Guest
Posts: n/a
 
      18th Aug 2006
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");








 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      18th Aug 2006
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" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      18th Aug 2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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");



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How get the virtual path based on the physical path? marss Microsoft ASP .NET 5 13th Sep 2007 05:20 PM
How can I determine the largest physical size cell in a column =?Utf-8?B?Y3NhMDAx?= Microsoft Excel Worksheet Functions 2 22nd Jun 2006 02:33 PM
Converting a UNC path to a physical file path =?Utf-8?B?U2ltb24=?= Microsoft Dot NET 2 29th Oct 2004 01:04 AM
Determine name /path of calling page mg Microsoft ASP .NET 5 2nd Jan 2004 04:29 PM
Physical path of a aspx Page at design time? Igor Microsoft ASP .NET 1 15th Aug 2003 09:41 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:45 AM.