473,471 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Permission Problem writing to Disk in Asp.NET application

Here's what I need to do:
Due to a bug in Crystal Reports ExportToStream() method I can't stream a
Crystal Reports directly to the client as PDF and I must must use the
Export() and put the the PDF on disk first and stream to the client. That's
just how it is.

Question:
So I need to let the aspx user have write permissions to disk.. NOT GOOD.
How do I solve this? Can I somehow write the PDF to disk in another thread
with other writes? OR are ther other ways around this?

best regards
/Lars Netzel
Nov 19 '05 #1
2 3393
Lars

Note : The code below is stripped from a asp.net project using a web
service. This project would relay a binary file from an internal web server
where Crystal reports is installed to an external web server. You will still
need write permissions for the directory you want to save to

You could try this, I hope It helps

Stream fs =
rep.ExportToStream(CrystalDecisions.Shared.ExportF ormatType.PortableDocFormat);
byte[] binaryfile = StreamToBinary(fs);
string docLocation = Server.MapPath(null) + @"\Docs\";
SaveFileToServer(binaryfile,docLocation,"my.pdf",D ateTime.Now);
Response.Redirect("Docs/"+"my.pdf");

public void SaveFileToServer(byte[] binaryFile, string docPath, string
docName, DateTime fileModifiedDate)
{
Directory.CreateDirectory(docPath);
MemoryStream m = new MemoryStream(binaryFile);
FileStream f = new FileStream(docPath+docName,FileMode.Create);
m.WriteTo(f);
f.Close();
m.Close();
File.SetLastWriteTime(docPath+docName,fileModified Date);
}

public byte[] StreamToBinary(Stream fs)
{
Int32 i = Convert.ToInt32(fs.Length);
byte[] b = new byte[fs.Length];
fs.Read(b,0,i);
fs.Close();
}
"Lars Netzel" <la*********@NO-SPAM.qlogic.se> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Here's what I need to do:
Due to a bug in Crystal Reports ExportToStream() method I can't stream a
Crystal Reports directly to the client as PDF and I must must use the
Export() and put the the PDF on disk first and stream to the client.
That's just how it is.

Question:
So I need to let the aspx user have write permissions to disk.. NOT GOOD.
How do I solve this? Can I somehow write the PDF to disk in another thread
with other writes? OR are ther other ways around this?

best regards
/Lars Netzel

Nov 19 '05 #2
Thanks but I can't ExportToStream due to a bug with record and
groupselections in the Crystal Reports Engine. so I can't use that code.

I need to write to disk with other permisisons than the ASPNET user

/Lars
"Kamal Vaghjiani" <ka***@mortgageuk.com> wrote in message
news:Ok**************@TK2MSFTNGP09.phx.gbl...
Lars

Note : The code below is stripped from a asp.net project using a web
service. This project would relay a binary file from an internal web
server where Crystal reports is installed to an external web server. You
will still need write permissions for the directory you want to save to

You could try this, I hope It helps

Stream fs =
rep.ExportToStream(CrystalDecisions.Shared.ExportF ormatType.PortableDocFormat);
byte[] binaryfile = StreamToBinary(fs);
string docLocation = Server.MapPath(null) + @"\Docs\";
SaveFileToServer(binaryfile,docLocation,"my.pdf",D ateTime.Now);
Response.Redirect("Docs/"+"my.pdf");

public void SaveFileToServer(byte[] binaryFile, string docPath, string
docName, DateTime fileModifiedDate)
{
Directory.CreateDirectory(docPath);
MemoryStream m = new MemoryStream(binaryFile);
FileStream f = new FileStream(docPath+docName,FileMode.Create);
m.WriteTo(f);
f.Close();
m.Close();
File.SetLastWriteTime(docPath+docName,fileModified Date);
}

public byte[] StreamToBinary(Stream fs)
{
Int32 i = Convert.ToInt32(fs.Length);
byte[] b = new byte[fs.Length];
fs.Read(b,0,i);
fs.Close();
}
"Lars Netzel" <la*********@NO-SPAM.qlogic.se> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Here's what I need to do:
Due to a bug in Crystal Reports ExportToStream() method I can't stream a
Crystal Reports directly to the client as PDF and I must must use the
Export() and put the the PDF on disk first and stream to the client.
That's just how it is.

Question:
So I need to let the aspx user have write permissions to disk.. NOT GOOD.
How do I solve this? Can I somehow write the PDF to disk in another
thread with other writes? OR are ther other ways around this?

best regards
/Lars Netzel


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

48
by: Joseph | last post by:
Hi I'm writing a commercial program which must be reliable. It has to do some basic reading and writing to and from files on the hard disk, and also to a floppy. I have foreseen a potential...
1
by: Klunk | last post by:
Hi, last week I moved the folder of my Intranet application to another disk of the same server. After this change all the ASP page return this error: Microsoft VBScript runtime error...
3
by: Yitzhak | last post by:
I am having "Permission denied" error while calling LogEvent method of WScript.Shell component. Basically, ASP page calls Windows Script Host Shell component to log events to the OS Application...
3
by: fripper | last post by:
When testing a VB .Net application on my system (with IIS installed) I get an error message when using the fileopen function and the file does not exist ... i.e. I want fileopen to create the file....
1
by: Mohan | last post by:
Hi, I have developed a .NET Windows application. I able to run(Execute) it from the local drive of my PC. If I try to execute it from the SourceControl(Clear case) or from Shared drives, then it...
1
by: Alessandro Zucchi | last post by:
Hi all, I'm developing a ASP.Net application. The most important future is to generate PDF files that MUST BE saved on the disk (of the server). To achieve this goal I set write permission on...
4
by: Santaji | last post by:
Hi, We have an ASP.NET application which needs to write some files on the disk. For these we need to give ASP.NET user the Write permission for that particular folder. This is possible from...
12
by: Chris Springer | last post by:
I'd like to get some feedback on the issue of storing data out to disk and where to store it. I've never been in a production environment in programming so you'll have to bear with me... My...
4
by: stephen | last post by:
Hi, I am getting an error while trying to create an excel file. "Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.