Acessing files from a Server remotely - c#

As the title says, I need to access files from a server remotely. After doing this, I need to show the files in a windows file/folder Dialog style.
I need this using Remoting.
It's not that simple since I have some problems:
I don't have access to the client UNC sharing;
I don't know where the \server\xpto is physically pointed;
The service at the server must use the physical path.
Also, the sharing must be enabled (not always is), I'd need to prompt username/password and I'd have the network path, not the physical.
So, it's like accessing a server in a data center using the client app.

I guess you can do it by a web application. Create a page on the server which can reach the local files on the server and displays a list of them on a grid. You can add some commands on the files as well. The page you created would act as a middleware to reflect the operations you want on the files.
hope it helps.

Related

Read files from client folder and upload to server - ASP.NET

What is the best way to get files from client folder (a folder that the client will choose the path) and upload to server?
Thanks.
You can't.
For privacy reasons, code from web sites running in a browser context is not allowed to enumerate files or directories on the client machine and send that information to a server. Imagine what would happen if it could!
You could possibly get around this limitation with some more complicated solution that includes a client side install (e.g. an ActiveX control) but this is simply not possible with ASP.NET alone.

not able to open a file from share drive

I was trying to browse a file(S:\Scalable Development\DRD_ToolPointManagement.doc) from shared location trough web browser using application. when I run my application in local, it is working where as if I push the code to dev and QA environment, not able to open a file
There are two different problems, firstly using a mapped drive and secondly access rights to the folder. Both of these depend upon which account the application is running under. Have a look at http://www.iis.net/learn/get-started/planning-for-security/understanding-built-in-user-and-group-accounts-in-iis
You need the built in group IIS_WPG which covers the application pool to have access to the network drive. If the S: drive is not mapped on the web server, you will also need to use the UNC path. If you look in Windows Explorer, your S: drive will appear something like
myshare (\\myserver) (S:) which should be translated to \\myserver\myshare\Scalable Development\DRD_ToolPointManagement.doc
Your domain administrator may need to allow access to the network share, and you may need to consider impersonation
When using the Web browser control, you're using the Internet Explorer. Thus, security settings may apply.
You need to change these in the Control Panel's internet settings of every machine you want to deploy to.
For example you may have to add the location to the trusted zone. Also, the target IE may not be configured to open Office documents in-place.

Uploading Files to Two Web Front End Servers - how to consolidate into one location?

I have built a web application which uses two web front end servers, the Users are randomly directed to either one through the same URL. The web app has specific functionality to upload and download files. When a file is uploaded, it is stored on a specific directory on the server to which it is uploaded.
The issue is that when a User uploads a file to the folder on Server 1, any user trying to download that same file from Server 2 will not be able to as it only exists on the server where it was uploaded.
What's the best way of solving this? I've looking at:
- Using a SAN, problem here is I don't want to change or create a domain
- Writing a Windows Service, would prefer to avoid this if possible, I've not done it before but will give it a go if necessary
Thanks in advance!
Joe
Unless I'm missing something very obvious, all you need is a shared location. This could be a network share addressed through a UNC path, a folder on an FTP server, a database, anything at all, as long as it's
shared,
accessible from both web-servers
web-application service account has read/write permissions to it.
From your requirements a network share on a file server (perhaps 1 of the 2 web-servers, or the load-balancer, or (ideally) a new server entirely) would be the simplest method.

App.Config Security in WPF

I am creating a WPF project, and deploying it using ClickOnce. Since the .xbap file is downloaded to the client, and run it from the client machine the client can edit the file and do anyting they wants. That is, if the App.Config file of my WPF appliaction is downloaded along with the .xbap file, and I use some settings to control the behaviour of the application, or use some info like my service detauls, and the user goes to the downloaded location and edits those details they can do anything with it. I have tested this, and this can be done. I have singed my assebmly and manifest with a .pfx certiciate
Since I have signed my assemsbly/manifest, if I perform the same action in the server, the application shows an HashVerification error. Why doesnt this happen in the client side. I think, this is far more important to work in client side then on the server side.
What is the work around to stop users? This could be a serious security issue for many apps. I think this can also be done with Silverlight apps, as it behaves same (not sure if I can paste my modified .xap file to Temporary Internet Folder).
Thanks
Never trust a client.
Whatever you are trying to prevent, expect the user to be an administrator and ready to hack your application.
If you have something to hide (password, connectionstring, ...) do not pass it to the client, keep it on the server.
What is the purpose of settings that cannot be changed by the user?
If you want these values to be constant in the deployed code, then I would consider making them constants or resources.

physical path in silverlight

I need to get physical path in silverlight. I'm using WCF service, I created one folder called 'Myfolder'. So I need to get the path of myfolder Please help me.
Silverlight doesn't allow direct access to the file system. However you can take advantage of Isolated Storage to read and write files on the client side. Here is a tutorial for that.
If you need access to a folder in the web application that is hosting your Silverlight app, use your service. Once you are in your OperationContract method, or even if you leverage the WebClient to make an AJAX style request, you can access the file system on the server but remember that is a different machine than your Silverilght client with the exception of when you do development (or browse your app on the server).

Categories