Solved

Display same page file name

Posted on 2009-05-03
3
148 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

777 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