SitePoint Sponsor |
|
User Tag List
Results 1 to 13 of 13
-
Mar 19, 2002, 13:42 #1
- Join Date
- Feb 2002
- Posts
- 14
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is it possible and if so, how would I do this in ASP?
I have a basic webpage that has a couple links that users can go to download certain document viewers. If the client has not downloaded the viewer, it prompts them to download it and if it already have been downloaded then it goes directly to the login page for the software that uses that type of viewer.
The problem is... that users don't always know if they have downloaded it before and click on the link to download it. If it already has been downloaded it takes them directly to that login screen. They don't want them to go directly to the logon screen at that point. They want them to do a check first to see if the file(s) exist and if they do take them to a different page where it tells them they already have the viewer installed. How would I write the code that would check the PC that the user is on to see if the file exists and if it does redirect them to another page and is that possible to be checking files on the user's own pc - is there some security implications?
Any help or advise would be appreciated.
mab
-
Mar 19, 2002, 14:16 #2
- Join Date
- Aug 2000
- Posts
- 248
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Well 2 ways come to mind:
1) Set a cookie when first downloading. Then on return visits if that cookie exists then redirect to your desired page. Problem is that not all users accept cookies.
2) You mention a login screen. I am not sure what kind of login procedures you have but if your users register first ( I am assuming that this is how they log on) then you can do a username/password look up in a database. If a record matches then redirect to the page of your choice.
I don't think that the second option is qwhat you are looking for but it is the one that will work with all users.
What kind of plug in do they have to download? I am kind of confused as to wether the login is on your end or on the download site.
Perhaps a link to the site will give a better overview of what you are trying to accomplish.
HTH
-
Mar 19, 2002, 15:09 #3
- Join Date
- Feb 2002
- Posts
- 14
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The site is located on our Intranet site so giving you the link won't help.
Also, the application doesn't put a cookie on your pc.
Is it possible to use a FileSystemsObject in ASP to see if the file exists on the local PC. Do I have to use a combination of Javascript and ASP?
I'm really new to ASP and all this stuff.
-
Mar 19, 2002, 16:06 #4
- Join Date
- Aug 2000
- Posts
- 248
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Try this:
dim objfso
set objFso = server.createObject("scripting.filesystemobject")
'You can use any path that you want below.
'I have seen this used over a network mapped drive before but don't forget to assign the correct permissions!!!
path = "/put/the/path/here/filename.extension"
MyLocation = server.MapPath(path)
'You could give it an exact path like this: MyLocation = "C:/put/path/here/filename.extension"
'If you use an exact path then remove the path= and the MyLocation = lines above
'now use properties of the File System Object to see if the selected file exists in the specified folder...
if objFso.fileExists(MyLocation) then
'DON'T show the download button OR redirect
'response.redirect("redirect page name")
else
'show your download button
'response.write("my download image")
end if
HTH
-
Mar 19, 2002, 17:11 #5
- Join Date
- Jun 2001
- Location
- Toronto, Canada
- Posts
- 9,123
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
FSO is for server side. There isn't any way, short of installing actual software (ActiveX would do nicely, but only on IE) on the client machine.
-
Mar 20, 2002, 11:15 #6
- Join Date
- Aug 2000
- Posts
- 248
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Also, the application doesn't put a cookie on your pc.
It would seem that if it's an intranet then you (or the IT depratment) can have control over cookies being turned on. It would seem a lot easier to get your application to set a cookie that to create the ActiveX control.
Jeremy is right... FSO is limited to the server but you do have options.
HTH
-
Mar 20, 2002, 15:07 #7
- Join Date
- Feb 2002
- Posts
- 14
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks for all of your suggestions. I've found a way to check on the client's PC since the other script checks on the server side like you said....
Here's what I used - I'll of course be changing the actions in the logic once the file has been detected.
I had to do some digging in the registry to find the name of the 'Sview.SviewCtrl.1' as there were many
files in the registry pertaining to the SwiftView viewer.
<html>
<body>
<script language="VBScript">
on error resume next
SwiftView = not IsNull(CreateObject("Sview.SviewCtrl.1"))
If (SwiftView) then
document.write("Swift View has been installed")
else
document.write("Swift View has not been installed")
end if
</script>
</body>
</html>
Thanks...
mab
-
Mar 20, 2002, 16:12 #8
- Join Date
- Feb 2001
- Location
- Clearwater, FL
- Posts
- 3,615
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You can check for local files with FSO!
Check this code out from www.w3schools.com
[vbs]<%
Set fs=Server.CreateObject("Scripting.FileSystemObject")
If (fs.FileExists("c:\winnt\cursors\3dgarro.cur"))=true Then
Response.Write("File c:\winnt\cursors\3dgarro.cur exists.")
Else
Response.Write("File c:\winnt\cursors\3dgarro.cur does not exist.")
End If
set fs=nothing
%>[/vbs]
Can't you invoke this script on the download page?
-
Mar 20, 2002, 16:22 #9
- Join Date
- Mar 2002
- Location
- msia
- Posts
- 487
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I am confused with all the replies, and I would like to have some clarification on the filesystem object.
The issue/problem posted by mab is he wanted to check the client side (user's) computer file system (and not the server/web host), so can the filesystem object of asp do this?
If yes, then it raise security issues because the web developer can check whether certain files exist in the user's computer, and record the findings into his database.
Thanks.Last edited by ckchin; Mar 20, 2002 at 16:24.
-
Mar 20, 2002, 16:42 #10
- Join Date
- Aug 2000
- Posts
- 248
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
FSO can't check on the CLIENT side.
IF MY post mislead you I apologize.
I thought FSO could read off another machine on the SAME NETWORK if it had rights but after asking around I was told that you can't and I haven't had time to test it out myself today. I really think that in an INTRANET setting with mapped drives and correct permissions it could be done but this is just a theory and not REALITY right now until I try it myself
HTH
-
Mar 20, 2002, 16:54 #11
- Join Date
- Jun 2001
- Location
- Toronto, Canada
- Posts
- 9,123
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
It is just a theory as you would need to map a drive to every computer and know which user was logged in and how that corresponded to each user.
You cannot do anything at all client side with FSO. Dan (moospot), that code will check what is on the server at location c:/blah/blah/blah
Perosnally, if you are saying all your intranet users need software [x] installed why not hand it off to the MIS department and ensure it is installed across the network?
-
Mar 20, 2002, 18:22 #12
- Join Date
- Feb 2001
- Location
- Clearwater, FL
- Posts
- 3,615
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I see. It check the local drive on the server! Gee, what'll they think of next?
Can you use a client side JS to check for the existence of a file?
-
Mar 20, 2002, 18:50 #13
- Join Date
- Jun 2001
- Location
- Toronto, Canada
- Posts
- 9,123
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Nope, that wouldn't be cool if sites could do that, though with activex you can
Bookmarks