These forums are read-only and considered to be an archive. Please use the new Community for future interaction and posts.

dynamic root folder

I'm looking for a way to send the user to a specific folder depending on their UserID and Password.
I'm authorizing the UserID and Password against a SQL 2000 table on a separate server.
The 3 fields in this table are UserID, Password, Folder.
Depending on the UserID, I want them to be sent to their specific Folder as their root.

I've tried different things SELECT strings, passing variables between asp pages, concatenating the wexRoot with other variables, etc.  Now I'm at the point where I've run out of any possibilites that I can think of.

Can anyone help me PLEASE?
THANKS!!!
Gavin 11/15/2002 2:39 PM
Have you looked over the forum? Many people have asked about this issue before and I think my previous replies would help you.
Cem Alacayir 11/19/2002 9:51 PM
I have reviewed the forums, but the only good message I can find on the topic is:
2 login profiles

I don't think it's the same thing. If I am missing the correct thread, I am sorry, but I am very interesting in the same information if someone could point me in the right direction.

Thanks
Dave
Dave Byrum 2/4/2003 7:15 PM
I recommend you to store user folder info in a session variable so that it's kept throughout the session.

' Store the user folder info at login once:
Session("userFolder") = folder info from your database/querystring/text file

' Then build the user path dynamically:
wexRootPath = RealizePath(wexRoot) & Session("userFolder")

Cem Alacayir 2/10/2003 7:16 AM
' Then build the user path dynamically:
wexRootPath = RealizePath(wexRoot) & Session("userFolder")


where to put this? because this doesn't work?
thomas 7/11/2003 5:34 AM
Hi,
I think I should explain this issue more clearly:

1. Edit config.asp / line 9 , declare wexRoot as a variable instead of a constant, i.e this line

Const wexRoot = "/"

should be replaced by these lines

Dim wexRoot
wexRoot = "/"

You may also change your base folder from "/" to some other folder.

2. Edit default.asp / line 83, modify this line

wexRootPath = RealizePath(wexRoot)

to this line

wexRootPath = RealizePath(wexRoot) & Session("user")

This will append current user's name to the base folder to build the home folder path.

3. Edit default.asp, if you are going to use query string method to pass the user name information (like default.asp?user=someuser), then insert a hidden field into the login form (between line 600-640),

<input type="hidden" name=user value="<%=Request("user")%>">

This will prevent user name information to get lost after clicking the login button.

Else if you are going to use text input box method then insert a text input box into the login form (between line 600-640),

<input type=text class=formClass name=user value="" size=21>

Between line 588-595 (if-block), you may validate posted user name and password against a database or some other source (add your authorization code).

Make sure that you set Session("user") to the user name if authorized (e.g correct password), i.e add this line after your authorization code

Session("user") = Request("user")


I think this covers it all. These steps above are applicable to current latest version which is 2.11.
Cem Alacayir 7/25/2003 8:42 AM
Cem, I tried doing step by step as you stated but for some reason it's not working, it apears that all the variable are loading, but i am not sure whats wrong. 

Thanks,
Greg
Greg Walker 3/29/2004 8:46 PM
Ok, I was able to get the previous lines working.
Thanks,

Here is the new problem. the username in ?user="username" is a virtual folder and for some reason this will not load, however when i click the link displaying the virtual folder that loads the works, so for somereason its not loading in webExplorer. I manually loaded ?user=test , test being a physical dir not a virtual and that worked. 

Now i am lost.

Can you please HELP!!

Thanks,
Greg
Greg Walker 3/29/2004 10:24 PM
Greg,
The problem may be about the querystring encoding.
For example, the correct encoding for the querystring

?user=/folder1/folder2

is

?user=%2Ffolder1%2Ffolder2

where / is escaped by %2F

You can use ASP's Server.URLEncode method for fixing your query strings to be passed.
Cem Alacayir 4/29/2004 6:38 PM
I'm trying to link directly to a folder (with a hyperlink), in another post, someone said that it can't really be done, but can this solution be used to accomplish this?

In other words, instead of saving a user name in the session variable, can we store the folder we want to direct the user to?

Any help is appreciated, thanks!
eric 5/21/2004 11:04 AM
Yes, You can. Just set the variable say 'folder' or request("folder")

so the path is like = "C:\" & request("Folder")
Travis Howle 6/14/2004 1:42 AM
Thanks Travis, I had gotten the variable root directory working, and I could pass in a variable from a form, and link directly to a specific sub-directory.

However, when I did this, the uploads stopped working, and I would either get an error, or it would come back and say that it was uploaded, but it really wasn't.

Once I changed the variable back to a constant, the uploads started working again.

Is this upload issue something that can be worked around?  Any help is greatly appreciated, thanks!
eric 6/14/2004 9:34 AM
Leave it at a constant, try that. And still use the variables. Just reset the variable.
Travis Howle 6/14/2004 1:29 PM
Tkx works with me... more details are impossible.
Rodrigo Brulon 8/28/2006 12:57 PM