?
Solved

Display same page file name

Posted on 2009-05-03
3
Medium Priority
?
153 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
ppittle earned 1500 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 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