![]() |
|
|
|||||||
![]() |
ASP Net - How can get the current virtual path without file name? |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Posts: n/a
|
Request.Path will get the current Path name with file name such as:
/Personal/Items.aspx How can I get the only Path name such as: /Personal |
|
|
|
#2 |
|
Posts: n/a
|
with vb, Left(Request.Path.LastIndexOf("/"))
|
|
|
|
#3 |
|
Posts: n/a
|
Try HttpRequest.ApplicationPath
Alex http://www.DotNet42.com - The Answer to Your .NET Question "farmer" <> wrote in message news: oups.com... > Request.Path will get the current Path name with file name such as: > /Personal/Items.aspx > > How can I get the only Path name such as: > /Personal > |
|
|
|
#4 |
|
Posts: n/a
|
Have you tried Request.ApplicationPath ?
"farmer" wrote: > Request.Path will get the current Path name with file name such as: > /Personal/Items.aspx > > How can I get the only Path name such as: > /Personal > > |
|
|
|
#5 |
|
Posts: n/a
|
Request.ApplicationPath return current Appliction's root virtual
Path,not the path one page belongs to. Wizard04's solution may make sense,I will try,thanks very much~ |
|
|
|
#6 |
|
Posts: n/a
|
Sorry Alex,HttpRequest.ApplicationPath makes no sense.
|
|
|
|
#7 |
|
Posts: n/a
|
Ok...but not so graceful.The much important thing is:is it reliable
enough for any URL pattern? |
|
|
|
#8 |
|
Posts: n/a
|
What you are looking for is Page.TemplateSourceDirectory
VB.NET : Dim currentDir As String = Page.TemplateSourceDirectory C# : string currentDir = Page.TemplateSourceDirectory; Juan T. Llibre, ASP.NET MVP ASP.NET FAQ : http://asp.net.do/faq/ Foros de ASP.NET en Español : http://asp.net.do/foros/ ====================================== "farmer" <> wrote in message news: oups.com... > Sorry Alex,HttpRequest.ApplicationPath makes no sense. |
|
|
|
#9 |
|
Posts: n/a
|
See my just-sent reply...
Juan T. Llibre, ASP.NET MVP ASP.NET FAQ : http://asp.net.do/faq/ Foros de ASP.NET en Español : http://asp.net.do/foros/ ====================================== "farmer" <> wrote in message news: oups.com... > Ok...but not so graceful.The much important thing is:is it reliable > enough for any URL pattern? |
|
|
|
#10 |
|
Posts: n/a
|
I am using C#,this makes sense:
string ThisPath=HttpContext.Current.Request.Path.Substrin g(0,HttpContext.Current.Request.Path.LastIndexOf(" /")); |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Error: Physical sythesis tool PALAC is not supported by Formal Verification tool Conf | bbiandov | Software | 0 | 12-22-2008 04:25 AM |
| SONY DVD RW DW-G120A SOMETIMES FAILS...... | atlantic965 | DVD Video | 0 | 06-18-2006 09:36 PM |
| problems backing up dvds | Lawrence Traub | DVD Video | 11 | 09-27-2005 06:34 PM |
| Re: Ripping DVDs. Please answer the attached question. - Question.txt | Stan Brown | DVD Video | 19 | 02-09-2005 10:19 PM |
| Burn process failed - help! Log file posted for help troubleshooting | Michael Mason | DVD Video | 1 | 08-16-2004 08:24 PM |