Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old June 11th, 2005, 02:18 PM
matthuxtable matthuxtable is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: UK
Posts: 165 matthuxtable User rank is Private First Class (20 - 50 Reputation Level)matthuxtable User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 10 h 34 m
Reputation Power: 4
Hi, My apologies for not posting the solution. I have been busy and didn't have the time to do so. Anyway here it is, happy coding!
-----------------------------------------------------
Basically, to access a web folder from the internet, you have to do two things
  1. First of all, you must enable WebDAV on your IIS server. In IIS 6.0, you do this by browsing to the computer running IIS 6.0, then click Web Service Extensions. Find WebDAV in the main area of MMC, highlight it and click Allow. This has now allowed Web Folders on your server.
  2. To automatically create the web folder from a web page, you need to add a few tags to the link(s) you want to open a web folder and also a link behaviour setting within STYLE tags. Here is some sample code:
    Code:
    <STYLE>
    A {behaviour: url(#default#AnchorClick);}
    </STYLE>
    
    <A HREF="http://your_site_URL_with_web_DAV_enabled.com/your_directory/" FOLDER="http://your_site_URL_with_web_DAV_enabled.com/your_directory/" TARGET="_BLANK">Open in Web Folder view</A>
In the code above, the FOLDER attribute of the A tag specifies the location of the web folder the link should open. However, browsers that do not support web folders continue to open the href tag, so you should still specify this. If your link does not contain the FOLDER tag, then it will open as a normal hyperlink, and not in a web folder.

However, this was not suitable for me, because I wanted to be able to open a user's home directory on the server. To do this, we need a little ASP code, a slight modification to the link shown in the sample above, and a virtual directory created on IIS.

See below for how to do this:
  1. First of all, we will start with the easiest thing, creating the Virtual Directory. Navigate to where you are storing the website, and create a virtual directory which points to the User Shared Folders directory on the server. The virtual directory should have read, write and browse permissions.
  2. Now, we need to place some ASP code before the Web Folders link in the page. This is shown below and is available for your use. The code should be placed between the style tags and web folders link.
    Code:
    <%
    
    ' Get the user name the user logged on as and store in a variable named LogonName
    LogonName = Request.ServerVariables("LOGON_USER")
    
    ' Only the username is required and not the domain name, so select only the user name from the LogonName string
    Position = InStr(LogonName,"\")
    
    ' Now select the right hand part of the LogonName string and add 1 to the Position string (so the \ is not selected seperating the domain name from user name)
    
    ' Add 1 to position string
    Position = Position + 1
    LogonUser = Right(LogonName,Position)
    
    ' Set variables used to nothing (except LogonUser - used for link)
    Set LogonName = nothing
    Set Position = nothing
    %>
    That does it for the ASP code, all we need to do now is change the link that opens the web folder.
  3. The link to open the web folder should read:
    Code:
    <A HREF="http://your_site_URL_with_web_DAV_enabled.com/your_virtual_directory_pointing_to_user_shared_fol  ders_location_on_server/<% Response.Write(LogonUser) %>" FOLDER="http://your_site_URL_with_web_DAV_enabled.com/your_virtual_directory_pointing_to_user_shared_fol  ders_location_on_server/<% Response.Write(LogonUser) %>" target="_blank">Open Home Directory</a>
That should give you a fully working remote documents setup. Obviously, you would have to build a site so it is user friendly. My code just shows you the basic setup.

My code only works if each users shared folder is named after their user name. The code would need to be modified if they are named differently.

Security is another issue, but Windows Server usually sets User Home Directories so that only the user whose directory it is can access it.

Hope this helps!

Matty
------
Have I helped? Click the scales icon to rate my post!
Comments on this post
Shadow Wizard agrees: great job Matty, thanks!

Last edited by matthuxtable : June 11th, 2005 at 02:20 PM. Reason: Added code tags to code without them!

Reply With Quote
  #2  
Old April 16th, 2006, 03:16 PM
matthuxtable matthuxtable is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: UK
Posts: 165 matthuxtable User rank is Private First Class (20 - 50 Reputation Level)matthuxtable User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 10 h 34 m
Reputation Power: 4
Quote:
Originally Posted by matthuxtable
Hi, My apologies for not posting the solution. I have been busy and didn't have the time to do so. Anyway here it is, happy coding!
-----------------------------------------------------
Basically, to access a web folder from the internet, you have to do two things
  1. First of all, you must enable WebDAV on your IIS server. In IIS 6.0, you do this by browsing to the computer running IIS 6.0, then click Web Service Extensions. Find WebDAV in the main area of MMC, highlight it and click Allow. This has now allowed Web Folders on your server.
  2. To automatically create the web folder from a web page, you need to add a few tags to the link(s) you want to open a web folder and also a link behaviour setting within STYLE tags. Here is some sample code:
    Code:
    <STYLE>
    A {behaviour: url(#default#AnchorClick);}
    </STYLE>
    
    <A HREF="http://your_site_URL_with_web_DAV_enabled.com/your_directory/" FOLDER="http://your_site_URL_with_web_DAV_enabled.com/your_directory/" TARGET="_BLANK">Open in Web Folder view</A>
In the code above, the FOLDER attribute of the A tag specifies the location of the web folder the link should open. However, browsers that do not support web folders continue to open the href tag, so you should still specify this. If your link does not contain the FOLDER tag, then it will open as a normal hyperlink, and not in a web folder.

However, this was not suitable for me, because I wanted to be able to open a user's home directory on the server. To do this, we need a little ASP code, a slight modification to the link shown in the sample above, and a virtual directory created on IIS.

See below for how to do this:
  1. First of all, we will start with the easiest thing, creating the Virtual Directory. Navigate to where you are storing the website, and create a virtual directory which points to the User Shared Folders directory on the server. The virtual directory should have read, write and browse permissions.
  2. Now, we need to place some ASP code before the Web Folders link in the page. This is shown below and is available for your use. The code should be placed between the style tags and web folders link.
    Code:
    <%
    
    ' Get the user name the user logged on as and store in a variable named LogonName
    LogonName = Request.ServerVariables("LOGON_USER")
    
    ' Only the username is required and not the domain name, so select only the user name from the LogonName string
    Position = InStr(LogonName,"\")
    
    ' Now select the right hand part of the LogonName string and add 1 to the Position string (so the \ is not selected seperating the domain name from user name)
    
    ' Add 1 to position string
    Position = Position + 1
    LogonUser = Right(LogonName,Position)
    
    ' Set variables used to nothing (except LogonUser - used for link)
    Set LogonName = nothing
    Set Position = nothing
    %>
    That does it for the ASP code, all we need to do now is change the link that opens the web folder.
  3. The link to open the web folder should read:
    Code:
    <A HREF="http://your_site_URL_with_web_DAV_enabled.com/your_virtual_directory_pointing_to_user_shared_fol  ders_location_on_server/<% Response.Write(LogonUser) %>" FOLDER="http://your_site_URL_with_web_DAV_enabled.com/your_virtual_directory_pointing_to_user_shared_fol  ders_location_on_server/<% Response.Write(LogonUser) %>" target="_blank">Open Home Directory</a>
That should give you a fully working remote documents setup. Obviously, you would have to build a site so it is user friendly. My code just shows you the basic setup.

My code only works if each users shared folder is named after their user name. The code would need to be modified if they are named differently.

Security is another issue, but Windows Server usually sets User Home Directories so that only the user whose directory it is can access it.

Hope this helps!

Matty
------
Have I helped? Click the scales icon to rate my post!
Well I was just trying to create this again (the last time I tried failed) and I can't work out how to use it from my own post earlier. I keep getting the directory listing rather than a windows explorer interface for some weird reason.

It's still strange how a search on Google turned this up though!
__________________
-------------------
Have I helped? If I have, please click the scales icon and add reputation!

Reply With Quote
  #3  
Old January 21st, 2008, 09:37 AM
bluecotton bluecotton is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 1 bluecotton User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 15 sec
Reputation Power: 0
Question

I am also having problems getting this hyperlink switch to work properly. Even through I've added the "FOLDER=" parameter to the hyperlink to my webdav directory, when clicking on the link I keep getting the directory listing rather than a windows explorer interface. There doesn't seem to be much help regarding this issue online. Has anyone been able to make this work?

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > Accessing Web Folder from the internet (Windows Explorer Interface)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway