Solved

Display same page file name

Posted on 2009-05-03
3
147 Views
Last Modified: 2012-05-06
Hello

I have an aspx page and it's called (MyForm.aspx), the thing is I want to dislpay this file name (MyForm.aspx) somewhere in my page, how do I do that?

VB.NEt code please :)
0
Comment
Question by:alfardan
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
ppittle earned 500 total points
ID: 24292602
You can use the HttpResponse object to obtain the virtual path from the FilePath Property:

Response.Write(Request.FilePath)

More info is available at: http://msdn.microsoft.com/en-us/library/system.web.httprequest.filepath(VS.80).aspx

If you just want the file and not the path you could do this:

Repsonse.Write(Path.GetFileName(Request.PhysicalPath))

PJ
0
 

Author Closing Comment

by:alfardan
ID: 31577438
I used (Response.Write(Request.FilePath))

However, Path.GetFileName(Request.PhysicalPath) gave me an error for the [Path] word in the syntax.

Thanks for providing alternative solution :)
0
 
LVL 8

Expert Comment

by:ppittle
ID: 24294850
Try Response.Write(System.IO.Path.GetFileName(Request.PhysicalPath))
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now