472,794 Members | 2,258 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,794 software developers and data experts.

Network file UNC Access from Web Application

I couldn't find anything that quite described this in whole, so I'm
going to post it since from what I can tell about 400 other people have
posted asking how to do this and received partial answers

To set up an IIS 6.0 application that can access a UNC drive.

1. Create/Identify a domain account with access to the required UNC
location
2. Add that user to the IIS_WPG group on the Web Server
3. Create an application pool on the Web Server
4. Right click the new application pool and Select Properties
Select the Identity Tab
Select Configurable radio button
Enter the Account from step 1 above
5. Create a Virtual directory pointing to the application and allow
script execution.
6. Right click the Virtual Directory and Select Properties.
7. On the Virtual Directory tab of the properties dialog, select the
Application Pool created above in the Application Pool drop down
Here is the aspx and the aspx.vb for a simple application that will
list the contents of any UNC (any UNC that the application pool
identity has read access)
Default.aspx______________________________________ _______________________________
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="lbError" Visible = "false" runat="server"/>
<br />
<asp:Label >UNC to display:</asp:Label><asp:TextBox
ID="TextBox1" runat="server" Width="356px"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" Text="List contents of
UNC" /><br />
<asp:Table ID="Table1" runat="server">
</asp:Table>

</div>
</form>
</body>
</html>

Default.aspx.vb___________________________________ _____________________________
Imports System.IO
Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Try
For Each dirname As String In
Directory.GetFileSystemEntries(TextBox1.Text)
Dim tCell As TableCell = New TableCell
tCell.Text = dirname
Dim tRow As TableRow = New TableRow()
tRow.Cells.Add(tCell)
Table1.Rows.Add(tRow)
Next
Catch ex As Exception
lbError.Text = ex.Message
lbError.Visible = True
Finally
End Try
End Sub
End Class

Oct 20 '06 #1
0 1472

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

36
by: Thomas | last post by:
after spending countless hours trying, i give up and hope to get some help in here. on server1 i got the web myweb.com with my test.asp. in the test.asp, i'm trying to read a file from an UNC...
5
by: Mike McIntyre [MVP] | last post by:
I am working on an issue where and ASP.NET web application on one computer (A) needs to access files on a network mapped drive (B). This application uses as DSN on (A) that maps a proprietory...
1
by: srivalli chavali via DotNetMonster.com | last post by:
Hi, I have a question regd. Windows authentication and network file access. My asp.net application doesn't use any of the .NET's authentication schemes (Forms, Windows or Passport) yet. I have...
8
by: Lam | last post by:
HI anyone knows how can I open a mapped network file in C#? I try string file = @"T:\file.txt"; it shows me the error: "Could not find a part of the path" but if I copy the file to my C dirve,...
5
by: Nirosh | last post by:
Hi All, Can any one suggest me a best way to do this .. I have a thrid party tool "EXE" that we need to use with our web service to manipulate some complex XML files, which reside in a...
5
by: Dave Kolb | last post by:
Is there any other solution for an ASPNET application to access network resources other than running as SYSTEM, using delegation (a nightmare to get to work) or the COM+ solution? I cannot seem to...
7
by: zxkuqyb | last post by:
I've written a simple ASP .NET web application that reads a text file and displays it in the web browser. Works fine when reading a local path; but fails with "can not find a part of the path", or...
5
by: Mitchell S. Honnert | last post by:
Is there a way, given the full path of a folder on a network, that one can programatically tell if you have Read access to that folder? I have an application where the user is able to select a...
3
by: Michel Smit | last post by:
Hello, I have a question. We have a webserver in a domain, DomainA, and a webserver in a DMZ with local users and groups only. I'm trying to copy a file from the DomainA webserver to the DMZ...
0
by: Niyazi | last post by:
Hi, I created application that store the data in SQL SERVER that reside on network. The client also use this application to access the resources provided with application. But is the client want...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.