nope, same message "permission denied"
Dom
Main Topics
Browse All TopicsFor some reason I cant get the window to navigate to the new address. The address is a local path to a file in the temp directory. Code is below. The function main simply uses a recordset to create a new html page in the users TEMP directory and the window.navigate is meant to just open this page but no go! I'm sure it is something simple but, any ideas?
'~~~~~~~~~~~~~~~~~~~~~~~~~
<script language=vbscript>
'**Start Encode**
Set fso=CreateObject("Scriptin
Set dbCon = CreateObject("ADODB.Connec
Set rs = CreateObject("ADODB.Record
pUBLIC STRdbcON
Public fsofile
Set wshell=CreateObject("WScri
Public PCName
Public Curdir
pcname=Wshell.ExpandEnviro
curDir=WShell.ExpandEnviro
Function sesbyDate()
strDBCon="Provider=SQLOLED
dbCon.Errors.Clear
dbCon.Open strDBCon
Main()
window.navigate CurDir & "\" & pcname & "Report.html"
End Function
'~~~~~~~~~~~~~~~~~~~~~~~~~
Dom
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
The file is being created in the users temp folder. Earlier in the script the curDir=WShell.ExpandEnviro
Dom
yeh but it is doing the file stuff fine. the file is creating and everything without any problems. to facilitate this the end user needs to add the intranet site to trusted sites and heavily reduce the activex security for these sites but it works fine once these changes have been done. The stuff that should be really secure (ie. actually changing files and reading environment variables) is working fine once the appropriate changes have been made. The bit that doesnt work is simply navigating to view a html file on the local machine. all it is is trying to change the address of the current window which I thought would be the easiest thing in the world to do. its just the equivalent of clicking on a link but it doesnt work. (you can tell how little web development i have done!)
dom
sgayatri, thanks for the input but if i was going to do that i may as well just post a link. i can find ways around it but i am just intrigued as to why i am having this problem. for example, i can use the wshell.run command to shell the path of the file and open in a new browser. therefore i could shell any command including hostile script. i can't understand why it would block me then from doing something as simple as navigating the current window to a new page.
dom
IE had some issues with cross domain security and they solved it by NOT ALLOWING it at all. This means that if you want to use a frame to load a diffrent domain from the current one it just tells you Access Denied..
The window.open option could solve your problem but if not .. try using a shell script to execute a new instance of IE with the file location of the current users file. Also remember that the shell command has to have local admin rights to do this or you would be back to the same problem...
Here is a alternet solution..
Instead of writing the file to the users PC.. let them download the thing... this way they can access it at there own will... To get that right send the browser a mall-formed header so it doesn't display the HTML file but wants to download it.. the rest is then up to the user..
Another idea is to write the file to a common file server and then redirect the user to that file server.
Cross doamin access is a bit of a mission...
Good Luck
Adesso21
domj,
I am not very sure about why you get that error. May be due to the reasons explained by Adesso21.
I could not understand much of what he is trying to tell.
I happened to see ur question in VB section and out of curiosity came here and posted my opinion.
That's all.
Adesso21,
If it is 'cross domain issue' , then enabling the security option 'Access data sources across domains'
in internet options , should solve the problem... Am I right?
Hi all,
Here I was thinking that it would be an easy fix! thunder_moose, yes the file is closed before I try to access it but I have been caught out with this before (as I am suremost people have)!
Adesso21, firstly, the page is published and accessed all on a common domain to which I am a Domain Admin and therefore I can't see where there should be a permissions problem. The window.open command doesnt work for me either (same issue, "Access Denied"). The shell command does work fine and I could use this method but then the user can't use the back button to get back to the first page and also it leaves the old page up and if I use a window.close to try and ditch it it comes up with the "Are you sure you want to close it" prompt. I am not sure what the suggestion regarding the downloading thing is. The reason that I am using a temp folder on the local PC is that the page is to display a report for a FTP synchronisation tool that I have written. The logs get pulled up into a SQL 2000 db and then I wanted a nice easily distributable reporting option to allow our help desk to access custom reports. The page allows the user to click on a number of links to run reports that it then prompts for user input and uses this info and embedded vb code to query the SQL db. It creates a recordset and then goes through each record, writing HTML containing this information into a new text document and then displays this document (or is meant to at least). The reason that this is done client side is because I dont have the skills to look at ASP or any server side solution.
All that said, the entire thing works great and apart from some early problems with security and the activex objects (like the fso and the environment variable access) and this one hiccup, the file gets created fine and you can manually go to the page and it displays like a charm. Its just that for some reason, IE locks down all access from code to anything that will get the current page to navigate away. I could redirect to a common file server but I dont know if that would even work. It might be worth a try and if someone was able to say "oh yeah, you cant do that because..." then i could look at another option but it just seems like the most trivial thing to be able to do from a webpage.
Thanks all for you input... Am still interested to hear if anyone has any further insight or common experience with a similar issue.
Dom
sgayatri
I am not sure that changing the setting in IE will do anything.. Last I read somthing about Microsoft wanting you to create some kind of Trusted certificate between the two domains and then implementing some funny browser security check .. I gave up..
As for the real question DomJ.. You are going to have to get your hand dirty with some kind of server side scripting.. The way you are going now is almost not possible. I get what you are trying to do, and let me tell you.. it's a breeze in server side scripting..
I like using PHP but ASP should be fine.. this is not rocket sience ... reporting.. but the way that you are trying to do it.. could be..
I hope you get a solution..
Regards
Adesso21
Excuse me, but shouldn't it be:
window.navigate CurDir & "/" & pcname & "/" & "Report.html"
or
window.navigate CurDir & "\" & pcname & "\" & "Report.html"
rather than:
window.navigate CurDir & "\" & pcname & "Report.html"
What I would suggest you to do first is print out (either in MsgBox, or better just to dynamically write it somewhere in the doc) the value of [CurDir & "\" & pcname & "Report.html"] and then just copy it and paste it to the address field in the browser.
also, put this output here, maybe we can see something in it....
Good luck
Zvika
No, that syntax is correct. The file path is "C:\Documents and settings\DominicJ\Local Settings\Temp\DominicJRepo
Dom
domj
I didn't mean you to use this as workaround. just as a debugging way to see that the path is built ok and that the file is actually there.
anyway, it looks wierd.
one more test for you. write a hard-coded file path, to a file you KNOW is already there. I mean, make a test. put a "test.html" file in c:\, and write the path "c:\test.html" hard coded in your function. see if that also fails.
supply the feedback and we'll see how we take i forward...
Zvika
well, 3 more suggestios, long shots in the dark...
1. Maybe the problem is in your target page, and not in the way to it. try to navigate to an empty html page, or a simple one (no frames, no dhtml code).
2. a phenomena i once have - what is the name of the site from which you try to navigate? if the site name contains invaid chars, some IE versions consider the site as "unsafe" and won't redirect.
[another test for option 2 and similar is to put your first page, the one that calls the navigation, on the same local machine.]
3. are you sure the permission denied is on the Navigate function? maybe it something else in your code? (maybe something in the Main function?)
I used the following file:
<html>
<head>
<title>bla</title>
<script language=vbscript>
Set wshell=CreateObject("WScri
pcname=Wshell.ExpandEnviro
curDir=WShell.ExpandEnviro
Function bla()
msgBox(CurDir & "\" & pcname & "Report.html")
window.navigate CurDir & "\" & pcname & "Report.html"
End Function
</script>
</head>
<body onload = "bla()">
</body>
</html>
and it works fine.
last possibility is that something is wrong in your permissions either in the browser properties (do remeber that your code generates ActiveX components that some users don't allow) or the folder properties.
Business Accounts
Answer for Membership
by: ZylochPosted on 2004-10-06 at 18:25:01ID: 12244799
Hi domj,
r & "\" & pcname & "Report.html" work?
window.navigate is IE only (not really matter since you're using VBScript. I wonder. Does window.location.href=CurDi
Regards,
Zyloch