Scott Cate Weblog 

scott.cate@myKB.com
http://scottcate.myKB.com



Scott Cate KB > ASP.NET Code Samples - Findings > ASP.NET Class Start Over
Search the Knowledge Base
 
Start Search in the Following Category
Date Modified
Monday, November 15, 2004
Retrieving File and Request Path Information

It seems to be a very common practice to check the URL and File paths. Many, Many scenarios require this information, and it seems that a lot of native classes are commonly overlooked. To bring awareness to classes that you may or may not know exist, I've thrown together a little table that shows several ways to get path information.

Syntax to Request Path Information Result
Request.ApplicationPath /MyWebSite
Request.CurrentExecutionFilePath /MyWebSite/Paths/Paths.aspx
Request.FilePath /MyWebSite/Paths/Paths.aspx
Request.PhysicalApplicationPath c:\inetpub\wwwRoot\MyWebSite\
Request.Physicalpath c:\inetpub\wwwRoot\MyWebSite\Path\Paths.aspx
Request.MapPath("/") c:\inetpub\wwwRoot\
Request.RawUrl /MyWebSite/Paths/Paths.aspx
System.IO.Path.GetFileNameWithoutExtension(Request.PhysicalPath) Paths
System.IO.Path.GetExtension(Request.PhysicalPath) .aspx
System.IO.Path.GetDirectoryName(Request.PhysicalPath) c:\inetpub\wwwRoot\MyWebSite\Path

Enjoy!!


All rights reserved. All details are the personal opinion of Scott Cate.
All trademarks referenced are the property of their respective owners.
Scott Cate is a lead programmer for www.myKB.com and
owner of The Arizona .NET User Group and an all around nice guy ;)


Knowledge Base Software - myKB.com

 

Cameron Cate Pictures
Cameron Cate Pix

Site Navigation

Home
Knowledge Base
Wiki Discussions
Photo Album

Sites I Own & Run


Easy Search ASP.NET
mykb.com knowledge base software logo
myKB.com
Knowledgebase Software

KBAlertz.com
Arizona .NET user Group
Group Leader

Affiliations


ASP.NET MVP
2004
2005
2006
2007
2008
2009


Blog Sites I Read

Brady Gaster
Rob Howard
G. Andrew  Duthie
Robert McLaws
Alex Lowe

World of Scott.Net

Scott Guthrie
  -  Father of ASP.NET

Scott Watermasyk
  - .Text (Weblog)

Scott Sargent
Scott Mitchell
ScottG.net
Scott Bellware
Scott Forsyth
Scott Hanselman
Scott Cate

Favorite Books


ASP.NET Cookbook


First Looks @ ASP.NET 2.0