hi ,
from asp.net,on button click how can i open a file in the document library folder. is my below code correct??
SPSite sp = new SPSite(urlName);
SPWeb sw = sp.OpenWeb();
Byte[] streamBuffer = null;
sp.AllowUnsafeUpdates = true;
sw.AllowUnsafeUpdates = true;
SPFile DocumentTemplate = sw.GetFile(path);
Stream documentTemplateStream = DocumentTemplate.OpenBinaryStream();
streamBuffer = new Byte[documentTemplateStream.Length];
documentTemplateStream.Read(streamBuffer, 0, streamBuffer.Length);
documentTemplateStream.Dispose();
return streamBuffer;
is this correct way of opening a file...if any other solutions please help me out.