Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capture Mappath to Variable

Status
Not open for further replies.

PenguinHead

Programmer
Jan 5, 2007
18
US
What is the correct syntax to capture the value from Server.Mappath to a variable?

I'm a newbie to ASP and I may be overlooking something very simple. This is how I am trying to capture the current URL but it gives me the following error.

My Code:
[tt]Set sPath = Server.Mappath("fm_include.asp")[tt]

My Error:
[tt]Object required: '[string: "M:\web\users\V025U37"]'[tt]

Thanks in advance.
 
Response.Write Request.ServerVariables("Server_Name") & Request.ServerVariables("URL")

-DNG
 
The error in your above code is that your trying to use "Set" when you are assigning a string, not an object. Set is only used for object reference assignments.
Code:
[s]Set [/s]sPath = Server.Mappath("fm_include.asp")

Additionally, if you want the path for the file that is executing you could also use a combination of Server.MapPath() and Request.ServerVariables("SCRIPT_NAME").

-T

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top