Question: How do I have an ASP page return it's own name? Let's say I have a page called "mypage.asp".  I want to insert the filename of the page into a string variable.  Right now, I'm just hardcoding on every page [strName="mypage.asp"].  Is there a way to have the page grab it off its own filename?

Answer: Using VB Script you can grab the file path, which returns the full file path of the current page (e.g. /somedirectory/somefile.asp). Once you have this, you'll need to split the value using the forward slashes. This will create a one dimensional array. Just grab the last item in the array and you have your file name. Below is a VB Script example:\n\n<SCRIPT Language=VBScript RUNAT=SERVER>\nFunction getFileName()\nDim lsPath, arPath\n\nlsPath = Request.ServerVariables("SCRIPT_NAME")\n\narPath = Split(lsPath, "/")\n\nGetFileName =arPath(UBound(arPath,1))\nEnd Function\n<SCRIPT>
This question from the Yahoo Q&A forum is categorized in the topic: Family & Relationships