SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Member
    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

  2. #2
    SitePoint Addict
    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

  3. #3
    SitePoint Member
    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.

  4. #4
    SitePoint Addict
    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

  5. #5
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    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.
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  6. #6
    SitePoint Addict
    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

  7. #7
    SitePoint Member
    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

  8. #8
    Xbox why have you forsaken me? moospot's Avatar
    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?

  9. #9
    SitePoint Evangelist ckchin's Avatar
    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.

  10. #10
    SitePoint Addict
    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

  11. #11
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    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?
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  12. #12
    Xbox why have you forsaken me? moospot's Avatar
    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?

  13. #13
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Nope, that wouldn't be cool if sites could do that, though with activex you can
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •