PDA

View Full Version : Set frame src using vbscript?


cc.shine
06-12-2003, 07:34 PM
I'm trying to set the source of one of my frames dynamically within the framset. I've created a function that determines the user and loads the leftFrame based upon the result. I'm not sure if something is wrong with my function or the manner in which I'm trying to call it from the frame src.

Any suggestions? TIA



<frameset cols="200,*" rows="*" frameborder="NO" border="0" framespacing="0">
<frame src="getLeftFrame(Request("leftFramePage"))" name="leftFrame" scrolling="no noresize id="leftFrame" >
<frameset rows="220,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="top.htm" name="topFrame" scrolling="no" noresize id="topFrame">
<frame src="main.asp" name="mainFrame">
</frameset>
</frameset><noframes></noframes>

<Script language="VBScript">

Function getLeftFrame(leftFramePage)

dim LogOn
LogOn = request.serverVariables("LOGON_USER")

if (len(LogOn) = 0) then
response.status = "401 Authenticate"
response.end
end if

dim objFSO
set objFSO = Server.CreateObject("Scripting.FileSystemObject")

if objFSO.FileExists ("c:/inetpub/wwwroot/fdc.inet/IS.txt") then
dim objTextStream
set objTextStream = objFSO.OpenTextFile ("c:/inetpub/wwwroot/fdc.inet/IS.txt", 1)

If LogOn = objTextStream.ReadLine then
LeftFramePage = "http://fdc.inet/Homes/IS/default.htm";
end if

objTextStream.close
set objTextStream = Nothing
end if

Set objFSO = Nothing

</script>

Roelf
06-13-2003, 09:52 AM
didnt test it, but i think this should do the trick: (if your function works correct)

<frame src="<% = getLeftFrame(Request("leftFramePage")) %>" name="leftFrame" scrolling="no noresize id="leftFrame" >

raf
06-13-2003, 10:28 AM
What's all that? Clientsided vbscript? Can you use FSO clientsided ?I think you have confused a few things (or I am :D). I also think it can be done easier and that the LogOn check insn't right --> what if logon isn't the same as the line from the file?
And why not open the frameset and then have the LogOn?

Roelf
06-13-2003, 10:32 AM
based upon this: LogOn = request.serverVariables("LOGON_USER"), i would say it was serverside code

cc.shine
06-13-2003, 02:06 PM
Yeah, well... This is my first scripting attempt. I'm more familar with vb, java and c++. This is just a temporary fix until I get the time to figure out why it won't just take the logon from windows. Sometihng to do with IIS, I'm sure, but I know even less about that.

Thanks for the input.

Cathleen

Roelf
06-13-2003, 02:21 PM
taking the logon from windows is only possible in the following circumstances:
The user, and the IIS-machine have to be known in the same domain.
The properties of the site have to be set so that anonymous login is not used.
Then you can take the windows logon from the servervariables collection

Roelf

cc.shine
06-13-2003, 02:55 PM
I tried playing around with the Directory Services based upon some info I found on the Internet. I changed the settings for anonymous access and integrating with windows. Still couldn't get it to work.

What do you mean by "The user, and the IIS-machine have to be known in the same domain"? I can hook up to the WebServer using pcAnywhere on the sly, but I'm afraid to just start trying different things.

TIA.
Cathleen

Roelf
06-13-2003, 03:13 PM
Originally posted by cc.shine
What do you mean by "The user, and the IIS-machine have to be known in the same domain"? I can hook up to the WebServer using pcAnywhere on the sly, but I'm afraid to just start trying different things.
Are we talking inTRAnet or inTERnet here?? For inTERnet, this will not work. The user who tries to access you site, is not known in the domain of your webserver. in the case of inTRAnet, it probably can be configured so it will work.

cc.shine
06-13-2003, 03:18 PM
inTRAnet.

Seems like it should be such an easy thing to accomplish, but of course, it's not.