473,655 Members | 3,072 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="Defau lt.aspx.vb" Inherits="_Defa ult" %>

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

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed 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.P age

Protected Sub Button1_Click(B yVal sender As Object, ByVal e As
System.EventArg s) Handles Button1.Click
Try
For Each dirname As String In
Directory.GetFi leSystemEntries (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 1504

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

Similar topics

36
16364
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 path with a FSO: Set myFile = Server.CreateObject("Scripting.FileSystemObject").GetFile("\\server2\myshare\myfile.txt") this fails with an Permission Denied. here's the deal:
5
3655
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 ODBC driver to data on a (B). The DSN directory path points to mapped network drive mounted on (A). When the ASP.NET application reaches the point where the ODBC drive is called to fill a DataSet it throws the following exeption:
1
8032
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 a login page where the users would supply their credentials and the business logic compares these credentials against SQLServer database and allows/denies access to the website.
8
11840
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, and use @"C:\file.txt"; it worked Thanks a lot
5
4462
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 seperate files server. we have mapped the fodler to a different folder and need to allow the EXE to process on the mapped drive. When I trigger the EXE via web service the EXE get the permission of the launching user (mean ASP.NET user) resulting a...
5
3104
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 impersonate a user and obtain network credentials using the DuplicateTokenEx call with appropriate parameters even though the call seems to not fail. I check my identity has changed but can only still do local commands. I would consider...
7
5826
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 "can not access network file" when attemting to access a UNC network path. I am using IIS 6.0 on Server 2003. SharePoint Portal Server is also installed on this server. I have granted full access to 'everyone' on the network file. An...
5
13289
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 number of search folders using the standard dialog control. There shouldn't be an issue with the search folder being on a local drive or a network drive. But if you don't have Read access to the folder, there's trouble. The user can see the...
3
5698
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 webserver. Het firewall is configured to allow traffic via NetBIOS by ip-address. File copy takes place in a .NET assembly. Problem is described as follows: when copying I get an error 'access denied'
0
3222
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 to register new customer or companies they will enter the information in Windows Form and the program automaticaly creates the WORD document under specific folder under application path. Once the empty word file created than ask user if they want...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8710
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8598
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7310
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1598
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.