Hi Paul,

I was getting access denied message from client machines, using
impersonation from below article resolved it

http://support.microsoft.com/kb/306158

Just  wrapping file copy code ,

 if (ImpersonateValidUser(userName, domain, password))
                {
                    using (var fileStream = new FileStream(filePathAndName,
FileMode.Create, FileAccess.ReadWrite))
                    {
                        using (var binaryWriter = new
BinaryWriter(fileStream))
                        {
                            binaryWriter.Write(bytes);
                        }
                    }
                    UndoImpersonation();
                    Console.WriteLine(downloadDetails.ToString());
                }





On Fri, Sep 21, 2012 at 10:37 AM, Web Admin
<web.ad...@syd.catholic.edu.au>wrote:

> Sounds like firewall. Can u confirm that SMB traffic is allowed between
> the SP server and file share?
>
> On 20 September 2012 13:02, Ajay <akhanna...@gmail.com> wrote:
>
>> I am creating a application page which gets the last major version and
>> copies it to a folder on file share.
>>
>> I have created a Shared folder where it should be copied to, and given
>> write rights to the folder. I have also given rights to Everyone
>>
>> If I run the application page from dev server, it creates the file to the
>> network share.  TM1 is the name of the share, I have tried the full path
>> \\gxxxxx72\D$\Ajay_EMS\TM1, but same result
>>
>>             const string downLoadpath = @"\\gxxxxx72\\TM1\";
>>             var filePathAndName = downLoadpath + excelFile.Name;
>>             if (bytes == null) return;
>>                 using (var fileStream = new FileStream(filePathAndName,
>> FileMode.Create, FileAccess.ReadWrite))
>>                 {
>>                     using(var binaryWriter = new BinaryWriter(fileStream))
>>                     {
>>                         binaryWriter.Write(bytes);
>>                     }
>>                 }
>>
>> When I run this application page from client machine, I get an access
>> denied error, works from dev server.
>>
>> I know this is more asp.net thing than sharepoint.
>>
>> Do you have any impersonation class or any code which will make it work.
>>
>> Any other advice welcome, this is internal environment, so I can give
>> permissions etc what is required.
>>
>>
>> _______________________________________________
>> ozmoss mailing list
>> ozmoss@ozmoss.com
>> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
>>
>>
>
>
> --
> Regards,
>
> Paul Noone
>
> SharePoint Farm Admin/Developer
> Infrastructure Team
> CEO Sydney
>
> p: (02) 9568 8461
> f: (02) 9568 8483
> e: paul.no...@syd.catholic.edu.au
> w: http://www.ceosyd.catholic.edu.au/
>
>
> _______________________________________________
> ozmoss mailing list
> ozmoss@ozmoss.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
>
>
_______________________________________________
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to