Web Forms :: Securely Access Server Drives And Folders

Nov 22, 2015

I have M:PDF-ImagesList-PDF drive on the Server with thousands of images stored.

On the M drive has folder:

M:PDF-ImagesList-PDF45404539532.pdf
4539533.pdf
4539534.pdf
4539537.pdf ...

How to access to the folder drive by using VB.NET or C# in the code-behind (securely: with username and password) for the users to be able to view images on the popup window?

See the code :

Protected Sub BtnServerDrive_Click(sender As Object, e As EventArgs) Handles BtnServerDrive.Click
Dim PartNumber As String = txtPartNumber.Text.Trim()
'Calculate the folder 4540 like container
Dim NumContainer as string = txtPartNumber.Text.Trim()
NumContainer = (txtPartNumber.Text.Trim / 1000 + 1).toString.Split(".").First

[Code] ....

How to achieve this results to access to the server drive to get images for view by using VB.NET or C# in code-behind. Servermappath, UNC, or else?

View 1 Replies


Similar Messages:

Web Forms :: Showing All Drives Of Dev Server?

Aug 5, 2010

I have implemented this in my website as per my requirement. [URL] It is working fine in local. But i moved that code to dev server today... it is showing all the drives of dev server. (But my fuctionality is it should show all the drives of local computer who is accessing this ste).

View 1 Replies

IIS Configuration :: How To Protect Files And Folders On Server So That No One Can Access Directly

Mar 14, 2014

In my application i uploaded PDF files and it is stored in particular path in application folder.

but the requirement is that files should not be delete or modify by any user like user privileges in windows.How to do this in asp.net ?

View 1 Replies

Building A Page To List Files In Directory On Web Server And Network Drives?

May 17, 2010

I have seen some examples on other sites , but since im not familiar enough with DirectoryInfo and Files from the System.IO namespace, i dont know how to change it to fit my needs. So i found a very simple example that works, but i have some questions.

Here is the code i found:

[Code]....

This works great and lists the files in my root directory.

#1 - What i need to know is how to accomplish the same thing but in a format i can control, this code simply displays the files at the top of my page and pushes everything down. So does anyone know of a good and simple tutorial written in C#?

#2 - I also need to be able to setup the code so that certain files within the directories are not displayed, as in the code behind files and other files to be determined by the business.

View 2 Replies

Web Forms :: Access Shared Network Folders

Aug 28, 2013

In my application, first, i have not connected to iis server, and trying to access secondary path at this time it is accessing that path. but when it is connected to IIS server, it is giving unathourizedaccess exception.

View 1 Replies

Listing Folders In Folders Then Creating Arrays In JS For Each Of The Folders?

Jun 21, 2010

Listing folders in folders then creating arrays in JS for each of the folders?

Directory Structure:

I have a directory structure as follows;

ad_folder
--folderA
--folderB
--folderC
--anotherFolder
--etcfolder
--afile.aspx
--anotherfile.gif
ad_code
--folderA
--folderB
--afile.aspx
--anotherfile.gif
ad_prep
--folderA
--etcfolder
--afile.aspx
--anotherfile.gif
ad_bin
--etcfolder
--afile.aspx
--anotherfile.gif
other Folder
files folder
assetsfolder
index.aspx
web.config
image.gif

Task at hand:

I want code in VB.NET to create javascript arrays of the folder contents that can then be used on the client end. I only need arrays for all folders contained in folders starting with ad_ and an array for all the base folders . like so:

var folders=["ad_folder","ad_code","ad_prep","ad_bin"];
var ad_folder=["folderA","folderB","folderC","anotherFolder","etcfolder"];
var ad_code=["folderA","folderB"];
var ad_prep=["folderA","etcfolder"];
var ad_bin=["etcfolder"];

note that I do not know the number of or the names of the folders, they can be different in different cases, I only have the root path.

[code]...

View 3 Replies

Webpages Cannot Access Folders (IIS)?

Jan 1, 2010

What setting must I change under IIS to allow access to the folders? I am looking for that settings for hours, nothing found.

It seems like it is giving a 403 error when I tried to access the folder.

View 2 Replies

Security :: Users Can Only Access Their Folders?

Sep 26, 2010

I have a web app were every user has its own folder so that they can store documents. What i would like to do is protect a user's folder so that only the owner can access it.

Example:

Username: ricky
Folder: ~/Files/ricky/ --> Ricky can access his folder but can't access Diana's

Username: diana
Folder: ~/Files/diana/ --> Diana can access her folder but can't access Ricky's

I'm using membership provider for the user authentication.

View 9 Replies

Security :: .net Cannot Access Network Folders?

Oct 26, 2010

I have a few computers (with Vista Business OS) connected in a private network. A C#.NET application running on one computer is currently able to access the network shared folders without problems. However, I am trying to get an ASP.NET application on that computer to access the same folders but I am getting "Access denied" errors. I added NETWORK SERVICE to all the shared folders' security (with full control) but it still gives the same errors.

View 4 Replies

C# - Access Folders In Root Directory?

Apr 4, 2011

I am developing an asp.net web application. I have to access one of the image in images folder in root directory. I am using following code in my code behind file.

string imageDirectory = HttpContext.Current.Server.MapPath("~/images/");
string imageUrl = imageDirectory + "/img1.bmp";

This works fine in my local machine. My question is does this code work when I move my application to production ?

View 2 Replies

Determine Account IIS 7 Is Using To Access Folders (and Other Resources)?

Apr 8, 2010

Often, out of sheer desperation I will end up enabling "Everyone" access on a folder that a web app is accessing (perhaps for file creation, reading, etc) because I can't figure which user account to enable access on.

Obviously, this is a very bad thing to do. Is there a way to determine what account IIS is using at that exact moment to access folders (and perhaps other resources like SQL Server, etc)?

Are there logs I can look at that will tell me? Or perhaps some other way? I usually use Windows Auth without impersonation. Not sure if that information is relevant.

View 4 Replies

Security :: Restricting Access To Folders And Pages?

Nov 16, 2010

I'm using user membership and roles. Below is my web.config for subfolder restriction.

[Code]....

The way I have above, no one can access this folder, mySub, except Administrators, Editors, and Members. However, here's what I want. I want to allow all and any user to the default.aspx page of this mySub folder and denied any other pages if they're not Administrators, Editors, and Members. One last thing, also denied access to addWord.aspx if they're not Administrators and Editors. I know I can list all the pages and give them various permission but I do not want to list all the pages. What's the best and easist way to accomplish this?

View 2 Replies

Authorize The Account To Access Some Folders In Project?

Jul 17, 2010

I want to authorize the asp.net account to access some folders in my project.

However, I get this error::

System.UnauthorizedAccessException: Access to the path 'D:ProgramingPartFromYamnWebExerciseWebExerciseAccordionImgs' is denied.

I am using win 7 so what is the name of the asp.net account that I should use?

View 3 Replies

Web Forms :: Get Users Local System Drives

Jan 23, 2012

getting user's local machine drives in asp.net

When i use the code below

foreach (DriveInfo drive in DriveInfo.GetDrives())

{       Console.WriteLine(drive.Name);}

after deploying in server it get servers local drives

View 1 Replies

Visual Studio :: Unable Access To Classes From Other Folders Out Side Project Files

Jan 24, 2010

im facing problem to access classes out side my project folders. for example if i want to use some methods from store.vb file inside my project i get error : Name Space is not defiend, i have tried all ways such as import sdf.ITracjer.Data

[Code]....

i can't fetch the Store Class Methods or Function because its out of project directory, as its showin in image.

View 3 Replies

Forms Data Controls :: Write A Code For Displaying A Files And Folders Of Server Directory Using Grid View In .net?

Jun 12, 2010

how can we write a code for displaying a files and folders of server directory using Grid View in asp.net?

View 3 Replies

Could Not Upload Files To Mapped Network Drives

Jan 7, 2010

I have created an application to upload files to a mapped network drive(say: Z:), but is showing the error:

System.IO.DirectoryNotFoundException: Could not find a part of the path 'Z'.

What i did:

Created a web page with FileUpload control & a button.In button click event i have used the code as below.

[Code]....

View 9 Replies

Networking - Accessing Mapped Drives When Impersonating?

Apr 19, 2010

Short Version: Can anyone say whether it's possible or not to use impersonation in ASP.NET to access mapped drives?

Long Version:
I'm currently using impersonation in ASP.NET to gain access to network files. This is working perfectly for any network file using a UNC path, but it is failing to access any files on mapped drives defined for the user account I'm impersonating.

For example, let's say a file lives on the network at "machinefolderfile.txt", and let's also say that drive S: is mapped to "machinefolder". We need to be able to access both the full UNC path, "machinefolderfile.txt", as well as the shorter, mapped drive path, "S:file.txt".

Obviously the standard ASP.NET process cannot access either.

Using a console application that runs under the local account with the mapped S: drive, calling File.Exists(@"machinefolderfile.txt") returns true, and File.Exists(@"S:file.txt") also returns true.

However, when impersonating in an ASP.NET context with the same local account, only File.Exists(@"machinefolderfile.txt") returns true. File.Exists(@"S:file.txt") returns false.

I'm testing with IIS 7 running on my local Windows 7 Professional box, though this will need to run in both IIS 6 and IIS 7.

Impersonation is handled with a couple of classes in C# which I'll include here:

public static class Impersonation
{
private static WindowsImpersonationContext context;
public static void ImpersonateUser(string username, string password)
{
ImpersonateUser(".", username, password);
}
public static void ImpersonateUser(string domain, string username, string password)
{
StopImpersonating();
IntPtr userToken;
var returnValue = ImpersonationImports.LogonUser(username, domain, password,
ImpersonationImports.LOGON32_LOGON_INTERACTIVE,
ImpersonationImports.LOGON32_PROVIDER_DEFAULT,
out userToken);
context = WindowsIdentity.Impersonate(userToken);
}
public static void StopImpersonating()
{
if (context != null)
{
context.Undo();
context = null;
}
}
}
public static class ImpersonationImports
{
public const int LOGON32_LOGON_INTERACTIVE = 2;
public const int LOGON32_LOGON_NETWORK = 3;
public const int LOGON32_LOGON_BATCH = 4;
public const int LOGON32_LOGON_SERVICE = 5;
public const int LOGON32_LOGON_UNLOCK = 7;
public const int LOGON32_LOGON_NETWORK_CLEARTEXT = 8;
public const int LOGON32_LOGON_NEW_CREDENTIALS = 9;
public const int LOGON32_PROVIDER_DEFAULT = 0;
[DllImport("advapi32.dll", SetLastError = true)]
public static extern int LogonUser(
string lpszUsername,
string lpszDomain,
string lpszPassword,
int dwLogonType,
int dwLogonProvider,
out IntPtr phToken
);
[DllImport("advapi32.dll", SetLastError = true)]
public static extern int ImpersonateLoggedOnUser(
IntPtr hToken
);
[DllImport("advapi32.dll", SetLastError = true)]
public static extern int RevertToSelf();
[DllImport("kernel32.dll", SetLastError = true)]
public static extern int CloseHandle(IntPtr hObject);
}

Then, during Page_Load, we basically do something like this:

Impersonation.ImpersonateUser("DOMAIN", "username", "password");

if (!File.Exists(@"S:file.txt"))
throw new WeCannotContinueException();

I realize using mapped drives isn't a best practice, but for legacy reasons it's desirable for our business. Can anyone say whether it's possible or not to use impersonation in ASP.NET to access mapped drives?

View 2 Replies

Easiest Way To Securely Transfer Data From One Web To The Next?

May 21, 2010

I have 2 web sites running on the same server. Web1 needs to transfer data to web2 (same web server, different webs), passing sensitive data from one to the next. The browser will be using https. Are cookies possible/advisable here? My initial thoughts where to encrypt the data and pass through the querystring, both sites using a shared key. Perhaps also pass an encrypted expiration date to prevent the url from being reused in history if it's on a shared computer. Figuring it's https and encrypted, initially it sounds ok. However, my gut tells me its unsecure. Another option is a session server but that seems a bit overkill for what I'm after.

What is the best way to securely transfer a single piece of data from 1 site to the next on the same web and do it relatively simply?

View 2 Replies

How To Download Folders And Files From Server Where Application Is Deployed

Feb 1, 2011

i have some .txt files which are inside of different folders, i want to download all files and folder on client machine.

View 4 Replies

Security :: How To View Only The Wegpage Content That Was Delivered Securely

Dec 18, 2010

When i run my page on https it giving me error Do you want to view only the web page content that was delivered securely?

This web page contains content that will not be delivered using a secure https connection. Which could compromise the security of the entire web page. This error i am getting when running it in IE8 In Morzilla i am having warning...Contains Unauthenticated Content. i have checked my page source code but not find any http content all are having relative path etc.

View 4 Replies

Visual Studio :: Publish Web Project - Securely - Best Approach?

Feb 14, 2010

I'm migrating from the website model to the web project model. In the past I used ssl/ftp (server is IIS7) to upload a website. The host (DiscountASP.NET) using VS2008 Publish to upload a project. VS2008 displays the alert that the password will pass in the clear. So ... what is the best practices approach to publishing a project?

1. SSL/FTP (not sure of the implications re: site compilation)
2. VS2008 Publish
3. VS2008 Web Deployment Projects

View 2 Replies

Security :: Sending Form Data Securely By Email?

Jan 17, 2011

I'm building a website for a client on which they want site visitors to be able to fill out a form with the relevant information along with their credit card details, and when they submit the form, the information will be sent to the client in an email. This is an experimental services that they're offering so they're not interested in real time credit card processing yet. If I just zip the collected data up into a password protected zip file, and send that in an email to the client, would it be secure? Or do I have to go further than that to secure the data?

View 1 Replies

Security :: Allowing User To Input HTML Code Securely?

Jan 30, 2011

I have a CMS page that allows the user to paste in or type HTML code into a TextBox in a FormView, then do an INSERT or UPDATE operation to an nvarchar(MAX) column in an SQL table. This is using an ObjectDataSource that refers to an insert or update method in a TableAdapter in my dataset.

When testing, the server initially warned me when I tried to input or update text containing HTML code; so I set the validateRequest="false" in my page header.

I gather this can be a serious security risk. What's the proper way to "validate" the string being input? Am I opening the database to SQL injection?

Only the site administrator has access to the CMS, but malicious could theoretically bust their way in...

View 1 Replies

How To Access Remote Server( Ie., Want To Access Online Server Not Local Server) In Application

Sep 29, 2010

I want to Access remote server( ie., want to access online server not local server) in my Application.. I change Settings in SQL surface Area Configuration---> Remote Connection ( checked the Local and Remote Connection ) Then while running the application it showing the following error.(I make off the firewall also) An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved