Home > Archive > ASP > August 2007 > folder details?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| Is there a way to get the subfolder, and folder that a file is in, using the
filesystem or something else??
Let's say my user.asp file is user specific.
it would be located in folders as follows
user/uni/user.asp
i would need a way of finding what the subfolder the file is in, as well as
the root folder it is in.
is this possible??
--
Thanks,
Bam
| |
| Evertjan. 2007-08-16, 7:56 am |
| Bam wrote on 16 aug 2007 in microsoft.public.inetserver.asp.general:
> Is there a way to get the subfolder, and folder that a file is in,
> using the filesystem or something else??
>
> Let's say my user.asp file is user specific.
>
> it would be located in folders as follows
>
> user/uni/user.asp
>
> i would need a way of finding what the subfolder the file is in, as
> well as the root folder it is in.
>
> is this possible??
<%=Request.ServerVariables("URL")%>
<%=Request.ServerVariables("PATH_INFO")%>
<%=Request.ServerVariables("PATH_TRANSLATED")%>
<%=Request.ServerVariables("APPL_PHYSICAL_PATH")%>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
| |
|
| ....
> Bam wrote on 16 aug 2007 in microsoft.public.inetserver.asp.general:
>
>
> <%=Request.ServerVariables("URL")%>
>
> <%=Request.ServerVariables("PATH_INFO")%>
>
> <%=Request.ServerVariables("PATH_TRANSLATED")%>
>
> <%=Request.ServerVariables("APPL_PHYSICAL_PATH")%>
>
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
Thanks for the reply, but that is only part of what I need.
the path_info and URL shows the same thing. What I need IS contained in
there, but is there a way to extract it?
so I could use the info like this. Say......
Request.ServerVariables("PATH_INFO")
gives me this for example::
Bam/uni30/index.asp Now what I need is to extract out the Bam varUSER
= "Bam" and varUNI = 30
is there a way to do this??
| |
| Daniel Crichton 2007-08-16, 7:56 am |
| Bam wrote on Thu, 16 Aug 2007 07:07:33 -0400:
> ...
[color=darkred]
[color=darkred]
[color=darkred]
[color=darkred]
[color=darkred]
[color=darkred]
[color=darkred]
[color=darkred]
[color=darkred]
[color=darkred]
[color=darkred]
[color=darkred]
> Thanks for the reply, but that is only part of what I need.
> the path_info and URL shows the same thing. What I need IS contained in
> there, but is there a way to extract it?
> so I could use the info like this. Say......
> Request.ServerVariables("PATH_INFO")
> gives me this for example::
> Bam/uni30/index.asp Now what I need is to extract out the Bam varUSER
> = "Bam" and varUNI = 30
> is there a way to do this??
Look at the Split function
eg.
vPathComponents = Split(Request.ServerVariables("PATH_INFO"),"/")
in the case of Bam/uni30/index.asp you'll find this gives the following:
vPathComponents(0) = "Bam"
vPathComponents(1) = "uni30"
vPathComponents(2) = "index.asp"
So you can just use those array elements
varUSER = vPathComponent(0)
varUNI = vPathComponent(1)
:)
Dan
| |
| Evertjan. 2007-08-16, 6:56 pm |
| Bam wrote on 16 aug 2007 in microsoft.public.inetserver.asp.general:
[please do not quote signatures. Removed]
[color=darkred]
> Thanks for the reply, but that is only part of what I need.
> the path_info and URL shows the same thing. What I need IS contained
> in there, but is there a way to extract it?
>
> so I could use the info like this. Say......
>
> Request.ServerVariables("PATH_INFO")
>
> gives me this for example::
>
> Bam/uni30/index.asp Now what I need is to extract out the Bam
> varUSER = "Bam" and varUNI = 30
>
> is there a way to do this??
Yes, thast is simple string manipulation,
and can be done, when you programme in asp-vbscript,
using instr(), left(), mid(), right(),
or, my preference, with Regex.
Or, if you like asp-jscript,
using the near equivalent functions,
or in even more consize regex.
Surely, you don't want to miss the joy of coding that yourself?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
| |
|
| >> Bam wrote on 16 aug 2007 in microsoft.public.inetserver.asp.general:
>
> Thanks for the reply, but that is only part of what I need.
> the path_info and URL shows the same thing. What I need IS contained in
> there, but is there a way to extract it?
>
> so I could use the info like this. Say......
>
> Request.ServerVariables("PATH_INFO")
>
> gives me this for example::
>
> Bam/uni30/index.asp Now what I need is to extract out the Bam
> varUSER
> = "Bam" and varUNI = 30
>
> is there a way to do this??
Hey thanks guys. You guys rock!!
I knew there was a way, but from being so sick, my mind isn't back to normal
yet.
Bam
| |
|
| > Look at the Split function
>
> eg.
>
> vPathComponents = Split(Request.ServerVariables("PATH_INFO"),"/")
>
> in the case of Bam/uni30/index.asp you'll find this gives the following:
>
> vPathComponents(0) = "Bam"
> vPathComponents(1) = "uni30"
> vPathComponents(2) = "index.asp"
>
> So you can just use those array elements
>
> varUSER = vPathComponent(0)
> varUNI = vPathComponent(1)
>
> :)
>
> Dan
so my code should look like something like this?
Request.ServerVariables("PATH_INFO")
vPathComponents = Split(Request.ServerVariables("PATH_INFO"),"/")
playername = vPathComponent(0)
vuniverse = vPathComponent(1)
am i missing something?
| |
|
| never mind. with some tweaking i got it based on Daniel's post
thanks again to both of you!!
| |
|
|
|
|
|