opening folder in web site structure in Windows - asp.net

I am trying to set up a hyperlink to open a Windows Explorer, so that it can display a folder on the web server that is within the web site.
So in IIS, we have inetpub/MyWebSite/subFolder/Data/
I would like to allow for a web page hyper link to open the folder /Data
I can set up a user account on the web server and only provide access to this folder. I can use ASP Membeship to restrict access here, and/or assign the Network Service acccount access.
I don't really care who can see this folder as anything that gets placed in here will only be temporary, and nothing is "Mission Critical" just a file that the web site will read and write to and then it gets deleted.
Any and all ideas and suggestions will be tested.
Thanks for any help.

Build a representation of the folder's contents (using a DirectoryReader and CSS) and display that. Don't actually try to display the physical folder.

this sounds like FTP, and if it's on an intranet, why not create a share? much less work.

Related

I want to access Images which is outside of the server

I'm gonna implement this on asp.net and my problem is I have some images in some others folder i can access those in run command in from windows explorer but i need to put those images to WEB and browse them automatically.
But i tried to do it it wont work because the images are outside of the server..how to do it? is there is a possibility of doing this?
Think of a small LAN Network and when you browse the web your friends specific location data should be display can we do it?
In IIS you can add Virtual Directory to your website and point it to network location of where the images are stored.
Here are instructions.

Access to the path 'C:\Sites\content\ServerIpAddress.txt' is denied

I create a web site that in Default web page of it i try to access to ServerIpAddress.txt file that is on server . now when i run my project on local host it work correctly , but when I upload it on Server(free host) i face with
error. can some one help me ?
You most likely do not have permissions access files on the shared server due to security issues. Consider moving data from that file to web.config app key.
or access the file as a relative path to your site. The remote sever will most likely not have the same folder structure as your local machine.
The account that is being used for the worker process of the web site has no (write)access to the file.
Configure the file (or folder) so that the ASP.NET process has access.
Another thing to look at is whether or not the path as stated in the code is the actual path on the server.
give full permission to ServerIpAddress.txt file. it will work.
Right click on content folder. Click Properties. Then from General tab uncheck the Read-only checkbox.
Then go to Security tab and Allow Write permission for your ASP.NET process.
Are you using a database? In that case how did you set up permissions for app_data folder? You have to set permissions in the same way.
If you are not able to do that, try moving the file inside of app_data folder and then check.
Right click on .txt file and select security and add network service .restart iis and try.It will work.

Uploading files to remote server using ASP.Net(VB) 1.1

I have a file uploading and viewing page in ASP.Net 1.1 using VB. Now the page will be visible in intranet as well internet. Here in my case the intranet and internet servers are different. How can i save the uploaded file in the intranet server and view from there subsequently when the activity is done using the internet server?
I'd suggest that you have both instances of the application (intranet and internet) save their uploaded files to a common location. I'm going to assume, given that you're targeting .net 1.1 that you're probably looking for a solution/directions for IIS 6.0 or below, rather than the 7.x that comes with Vista/Server 2008.
You need to firstly decide where you're going to store the uploaded files, it could be on the Intranet server, the Internet server or a 3rd "filestore" server. Having done that, you can map that location to a commonly named Virtual Directory on each of your two web servers as follows:
Start "Internet Information Services (IIS) Manager" (Start > Control Panel > Administrative Tools)
Expand the "Web Sites" node and find the virtual directory for your application
Right click on the virtual directory and choose "New" > "Virtual Directory..."
In the wizard that appears, give the folder alias as something like SharedUploadFiles
Specify the path in the next step as something like \\192.168.100.1\SharedUploadFilesStore (i.e. wherever you've chosen to store the files
The next step will require security credentials. Set these as a username and password that has read/write access (as appropriate) to the share you've specified in step 5.
In the "Virtual Directory Access Permissions" step set the permissions as appropriate, click Next and then Finish.
Your application will now be able to access files in that share as if they were part of your web servers file system. So, if you had a file located at \\192.168.100.1\SharedUploadFilesStore\sample.txt, you would then be able to access it through both:
http://internetdomain.name/MyWebAppName/SharedUploadFiles/sample.txt
and
http://intranet.mycompany.local/MyWebAppName/SharedUploadFiles/sample.txt
My knowledge of how to solve any issues you encounter whilst configuring this isn't that deep, and you'd probably get a better answer at http://www.serverfault.com/ as whilst your question is a programming one, the answer I've given isn't a programmatic solution (not that it always has to be! =)

ASP.NET MVC - Website paths

I am using a 3rd party component which creates settings files based on hard-coded file paths i.e. they are compiled into the DLL e.g.
%APPDATA%\Vendor\Settings.ini
I have created a few console/service applications that use this and work very well. However, I am now trying to use a similar approach via my ASP.NET MVC web application and the settings file never seems to write out!
Usually if the application is running under my acconut for example the file would be written to somewhere like:
C:\Documents and Settings\James\Application Data\Vendor\Settings.ini
So I thought if the website AppPool was running under the same account the file would be saved to the same place....However, it never appears. The account is an admin account running under Windows server 2003.
Any ideas?
Thanks.
Have you checked to see if the settings file is created in the App_Data folder in the web application? If not, could you put an existing settings file there and see if it uses it?
It's not about the webpool account, it's about guest user's account.
Go to the properties of your site in IIS, Directory Security and in the anonymous access click on the Edit button, there you'll see wich account is been used when someone access your site.
Couldn't find a solution to this, so I decided to develop a local WCF service (which would create the settings file in the correct directory path) and just accessed it via my web application.

Protect folder from external requests

Im working with asp.net 2.0, and i have a folder into my application path ~/Data/ with some .mdb files.
I would like to protect this folder from external request like http://www.whatever.com/Data/whatever.mdb
But i would need to give any permission to my application, cause im using OleDBConnections agains the ~/Data/ Path.
What could be the best way to protect this folder?
Kind Regards.
Josema.
In IIS manager and remove at least anonymous access if not all access. Your application code can continue to use its contents but HTTP requests can not access it.
If possible in your situation, another option would be to place the mdb files outside of the website. For example, something like this directory structure:
/ MyProject
/ Data
- whatever.mdb
/ www
- Default.aspx
where www is the actual root of your website. That way, users will never be able to access the mdb files from the browser, while you can still use OleDBConnections against the mdb files. To my knowledge this is pretty secure, and this way you can't accidentily forget to disallow access in IIS.
Did you check if it actually is a problem?
I'm using ASP.NET 3.5 here but the default App_Data folder is shielded for downloading. Maybe you should just follow the guidelines and verify.
As for the other answers about moving Data outside your Web folder, that usually won't work when you use a hosting provider.

Resources