Solved

Display same page file name

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

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…
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 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

12 Experts available now in Live!

Get 1:1 Help Now