.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
ASPEvil
david stephan
Santhakumar Munuswamy
Fauzul Azmi
Post New Web Links

WPF copy file

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :WPF
 

Hi.

I am currently writing a WPF application to push files to a production server when the user clicks on "Push Files" button.  My issue is that the user themselves should not be given permission directly to the folder on the destination server as that is handled by the application.  Also, because the application is local this means that the user's Windows authentication runs the app so those are the credentials that the application uses when pushing the files. 

In an ASP.NET implementation, the IS virtual directory or website could be set up to use alternate login credentials such as a predefined login other than the user's login, which has access to push the files to the destination server so that would work, but I have already designed the application in WPF.  I am a WPF newbie and this is a small application so it was a great candidate for my learning curve.

Is there some way that I can securely push the files through the application as a different user, or maybe I should be using a different method of authentication for this job.

The application is an XBAP application.

Hope someone has some input for me because, even though this is a small application, I would not like to go back to doing this in ASP.NET now that I have a great *otherwise* working application.

Thanks, Ni


View Complete Post


More Related Resource Links

Can not copy: The file exists. (Explorer View)

  
Hello Community,               I used to copy bunch of files from windows explorer to sharepoint 2007 document library in its explorer view. But now I could not. It gives me error "Can not copy xyz: The file exists". The files does not exists already.             I also created many different new files [Different Name/Different File Type] and copy to server but still no luck. I have logged in to SharePoint with Admin Account and verified that no such file already exists.             I have the many machines and using Windows XP and Windows 7. For Windows 7 I never found the problem and Windows XP [with IE 6] if I use normal user for windows logon [Normal user have the “Full Control” permission in SP] I cannot use drag and drop files. It shows the error message “Cannot copy file <filename> The file exists”. For “My Network Places” I created and point to document libraries such as http://serversite/Docs [“Docs” It’s a document libraries list] but no luck. I tried from multiple Windows XP workstations and It works in few but cannot make out any differences between these machines.          &n

SQL-Server 2005 x64 / windows server 2003 x64 crashes during file copy

  
Hi We are running: Microsoft SQL Server 2005 Standard - 9.00.4294.00 (X64) Microsoft Windows Server 2003 R2 Enterprise x64 We have gigabit interface. Today we copied a file (using robocopy) from our databaseserver to another server (backup-server). The copy was started from the backup-server and source were specified using UNC. The copy were using about 20% of the bandwith (about 200Mbit). During the copy, sql-server reported several errors, for example: AppDomain 15 (mp.dbo[runtime].14) is marked for unload due to memory pressure. The client was unable to reuse a session with SPID 75, which had been reset for connection pooling. This error may have been caused by an earlier operation failing. Check the error logs for failed operations immediately before this error message. ***Stack Dump being sent to [PATH\SQLDump0005.txt Resource Monitor (0x1384) Worker 0x000000008000C1C0 appears to be non-yielding on Node 0. Memory freed: 0 KB. Approx CPU Used: kernel 15 ms, user 218 ms, Interval: 428541. So to me it appears that sql-server crashed during a file copy. We have 27 GB ram. With 24.5 GB dedicated to SQL-Server. The files we copied were quite large, some over 50GB. I found a similar issue about this: http://support.microsoft.com/kb/920739/ Do you think the issue above could be the cause of the sql-server crash? ///Patrik

Powershell script to copy a list attachment to a file

  
I have a script that builds a list of items.  I'd like to add the ability to download the list items' attachments to a local directory.  IS this possible?  There are lots of examples of how to add attachments but nothing that can download the attachments.  Any help would be appreciated.

SPTimerJobDefinition to copy xml file to all wfe's

  
I am thinking of creating a timer job that reads some data from some lists and in the end generates an xml file. The XML file is copied to a specific location and it needs to exist in that location on all of the web front ends. The question I have is that using a SharePoint Job if I run some code that copies it to that location (lets say somewhere in the layouts folder) will it automatically copy it to that location on all web front ends?Visit my blog http://jasear.wordpress.com

Cannot create/shadow copy 'Microsoft.Practices.EnterpriseLibrary.Data' when that file already exis

  
Lately I am getting this error when compiling my application. Does anybody have an idea what is going wrong??? Cannot create/shadow copy 'Microsoft.Practices.EnterpriseLibrary.Data' when that file already exists. === Pre-bind state information ===LOG: User = DREAMCATCHER\BischiLOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.Data Calling assembly : (Unknown).===LOG: This bind starts in default load context.LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/shareyourlossweb/887ea9ec/383e808e/Microsoft.Practices.EnterpriseLibrary.Data.DLL.LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/shareyourlossweb/887ea9ec/383e808e/Microsoft.Practices.EnterpriseLibrary.Data/Microsoft.Practices.EnterpriseLibrary.Data.DLL.LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).ERR: Failed to complete setup of assembly (hr = 0x800700b7). Probing t

Can't copy LDF file after detaching database.

  
Hello, I'm attempting to move an LDF file from one drive to another with more space.  I've detached the database in question, but when I go to copy the file I get the error, "Cannot copy [filename].  It is being used by another person or program." Is there another SQL Server process that is keeping this file locked?  How would I check? Thanks for your help.

LINQ to SQL Compact db, file copy issue

  
Our application uses LINQ and SQL compact database .sdf file as datasource.  It is using Miscrosoft SQL Server Compact 3.5 SP 1 and .NET Framework 3.5 SP1. We store our application's project data into a .sdf file.  When our application opens a .sdf file (e.g. projectA.sdf), it will make a temporary copy of it and open the temporary file instead of the original file.  If we change one table cell value (i.e. one property value of an object that is created by LINQ), and call DataContext.SubmitChanges(ConflictMode.ContinueOnConflict), and then call File.Copy(DataContext.Connection.Database, filename, true); to copy the temporary file back to the original file (replacing the original one).   We found that the table value is not changed in projectA.sdf.  But in the temporary copy, the value is changed.  If we re-open db connection by calling DataContext.Connection.Close(); DataContext.Connection.Open(); right before calling File.Copy(), the changed value is copied successfully to projectA.sdf. If we do a lot of value changes in the database, or adding / deleting table row, then submit changes.  Without re-opening the db connection, after File.Copy(), the projectA.sdf have those changes copied. This strange behaviour looks like the temporary db file is cached.  For a small change, the cached version is not changed.  The File.Copy() use t

Downloading a document from a sharepoint site to local file system, copy web service returns null

  
Hi Guys,
               I am trying to get this done for the last 2 days and I am still banging my head to the wall.
All I need to do is to download files from my sharepoint site library that uses integrated windows authentication. I was using copy webservice : getItem method to accomplish this.

CopyService.GetItem(copySource, out myFieldInfoArray, out myByteArray);

Problem : myByteArray is always returned as NULL

Note: I have tried the same with another site that uses forms authentication but the result was the same (NULL !!)


This is my code:

CopyService.

Copy copy = new CopyService.Copy();

 

Copy file from SFTP

  

Hi all,
I need to create an application which copies files from SFTP and paste them on my computer.

Can anyone please tell me how can I do this. I do not want to use any library of other providers like j* or others.

Regards,
Kunal


VWD 2010: Copy Web Fails if File Exists on Remote Site

  

Hi,

I just started using VWD 2010 and I used Copy Web to upload the site to the server. However, whenever I try to upload a new version of a file that I've already uploaded, the upload fails, with this error in the log (as an example):

Copy from 'C:\Users\Lou\Documents\Visual Studio 2010\WebSites\genusus10\tools' to 'ftp://69.67.214.24/web/tools' started at 10/6/2010 4:00:33 PM.
            tools
            Copy file password.aspx.vb from source to remote Web site.
            Has error -- Unable to add 'tools/password.aspx.vb' to the Web site.  The file tools/password.aspx.vb has been modified by (unknown) on 06 Oct 2010 11:45:33 -0500.

Copy from 'C:\Users\Gen\Documents\Visual Studio 2010\WebSit

Copy file from zip file using Shell .. need permission ?

  

I am using the below code to extract files from a zip file.

I am doing this inside a WCF and it is hosted as a windows service.

If i run the windows service without giving a user name it extracts fine. but when i give a user name and  a password for the windows service to run it does not extract the files.. just pass the copyhere command with out any exceptions ..

any help please..                        

 

using Shell32;

_shell = new Shell();

                        Folder srcFlder = _shell.NameSpace(_zipFilename);
                        Folder destFlder = _shell.NameSpace(_unzippedDirectory);
                        if (srcFlder != null)
                        {
         

Help with permission settings for System.IO.File.Copy?

  

I have a vb.net 2010 program in ms vb express '10 for copying files from the root directory of the Documents folder to either an SD card in a reader or a flash stick but when I run it throws this exception: A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll

Here is the underlying code:

 

Public Class Copyto
  Shadows Sub SdBackup()
    Dim Hdrive As String
    Hdrive = "H:"
    Dim Origin As String
    Origin = My.Settings.UserDocs
    System.IO.File.Copy(Origin, Hdrive)
  End Sub

  Sub FormLoad() Handles MyBase.Load
    My.Settings.UserDocs = My.Computer.FileSystem.SpecialDirectories.MyDocuments
  

Help with permission settings for System.IO.File.Copy?

  

I have a vb.net 2010 program in ms vb express '10 for copying files from the root directory of the Documents folder to either an SD card in a reader or a flash stick but when I run it throws this exception: A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll

Here is the underlying code:

Public Class Copyto
  Shadows Sub SdBackup()
    Dim Hdrive As String
    Hdrive = "H:"
    Dim Origin As String
    Origin = My.Settings.UserDocs
    System.IO.File.Copy(Origin, Hdrive)
  End Sub

  Sub FormLoad() Handles MyBase.Load
    My.Settings.UserDocs = My.Computer.FileSystem.SpecialDirectories.MyDocuments
  End<

File.Copy to Program Files Directory.

  
I searched high and low and have found some discussions on this topic but do seem to see any solutions.   So here is my issue.   I have an application that will copy 2 files to the Program Files directory.   What happen is, when I run it and the files exist (this should be what normally happens) I get accessed denied.   If I try to do a File.Delete (in code) first I get an access denied, however I can manually (in OS windows explorer) delete the files and then the copy will work.   I am running the application as Admin, so permissions to the folder are good.  

The application is restoring a 3rd party software file that tends to get corrupted a lot.   We have mechanism that will back this file up, but when I try to restore it I get the problem described above.   (not a file lock issue, I have made sure no programs have a handle to the file)

OS = Vista32
Program written in C#

Is there anyway of accomplishing this?

Thanks

copy files which are before a certain file

  

Hi Guys

How can I copy files which are before a certain file?
 
Eg.  file1 created at 10:10:00
        file2 created at 10:20:20
        file3 created at 11:11:11
        file4 created at 12:12:12
 
I want to copy files created before file3 which are (file1 and file2)
 
Using Batch programming


Unable to copy file "obj\Debug\Project.dll" to "bin\Project.dll"

  

Hi. This is really flustrating. When i compile my WebApplication, it works normally. But when i do refresh in browser, than IIS somehow "locks" that dll file and another compilation ends with this error:

Unable to copy file "obj\Debug\Project.dll" to "bin\Project.dll". The process cannot access the file 'bin\Project.dll' because it is being used by another process.

After restarting application pool in IIS, it's released and i can compile in standard way. I tried use handler.exe from sysinternals and it shows, that w3wp.exe process is using that dll. It's very time consuming before every compilation restart IIS. Any ideas where can be a problem please ?

Microsoft Windows Server 2003 Standard Edition SP2
IIS 6.0 

Microsoft Visual Studio 2005 Professional
Version 8.0.50727.762  (SP.050727-7600)
Microsoft .NET Framework
Version 2.0.50727 SP1
Microsoft Web Application Projects 2005
Version 8.0.50727.762
Microsoft Visual Studio 2005 Professional Edition - ENU Service Pack 1 (KB926601)


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend