473,805 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
+ 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 3412
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.ExportToStr eam(CrystalDeci sions.Shared.Ex portFormatType. PortableDocForm at);
byte[] binaryfile = StreamToBinary( fs);
string docLocation = Server.MapPath( null) + @"\Docs\";
SaveFileToServe r(binaryfile,do cLocation,"my.p df",DateTime.No w);
Response.Redire ct("Docs/"+"my.pdf") ;

public void SaveFileToServe r(byte[] binaryFile, string docPath, string
docName, DateTime fileModifiedDat e)
{
Directory.Creat eDirectory(docP ath);
MemoryStream m = new MemoryStream(bi naryFile);
FileStream f = new FileStream(docP ath+docName,Fil eMode.Create);
m.WriteTo(f);
f.Close();
m.Close();
File.SetLastWri teTime(docPath+ docName,fileMod ifiedDate);
}

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******** ********@TK2MSF TNGP09.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***@mortgage uk.com> wrote in message
news:Ok******** ******@TK2MSFTN GP09.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.ExportToStr eam(CrystalDeci sions.Shared.Ex portFormatType. PortableDocForm at);
byte[] binaryfile = StreamToBinary( fs);
string docLocation = Server.MapPath( null) + @"\Docs\";
SaveFileToServe r(binaryfile,do cLocation,"my.p df",DateTime.No w);
Response.Redire ct("Docs/"+"my.pdf") ;

public void SaveFileToServe r(byte[] binaryFile, string docPath, string
docName, DateTime fileModifiedDat e)
{
Directory.Creat eDirectory(docP ath);
MemoryStream m = new MemoryStream(bi naryFile);
FileStream f = new FileStream(docP ath+docName,Fil eMode.Create);
m.WriteTo(f);
f.Close();
m.Close();
File.SetLastWri teTime(docPath+ docName,fileMod ifiedDate);
}

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******** ********@TK2MSF TNGP09.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
8519
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 problem. The program may crash unexpectedly while writing to the file. If so, my program should detect this during startup, and then (during startup) probably delete the data added to the file and redo the writing operation.
1
6075
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 '800a0046' Permission denied: 'CreateObject'
3
19189
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 Event log. My environment: Windows Server 2003, IIS 6, WSH, Classic ASP, Vbscript Below is the code and the error: Code:
3
2947
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. The message I get is: * * * * * Access to the path "c:\inetpub\wwwroot\_private\(filename)" is denied. The ASP.NET process is not authorized to access the requested resource. For security reasons the default ASP.NET process identity is...
1
3458
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 is not starting the application, but given the below error. Request for the permission of type System.Security.Permission.RegistryPermission, mscorlib, Version=1.0.5000.0, Culture=neutral,PublicKeyToken=b77a5c561934e089 failed
1
1254
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 destination folder using "Windows permission". Is possible set write permission using Web.Config (or other configuration file) without use Windows Permission ? Thanks
4
2546
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 Windows explorer. We don't want to given permission from Windows Explorer. Is there any way of giving Write permission for folder through code ? We want to assign the Write permission for the folder at the installation time. Is it possible ? Please let...
12
3773
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 question is about storing data in a database. Yes I understand that you can link to a database in your program and read and write to the database etc etc. Well, that's all find and dandy but what if the person you're writing the application for...
4
9100
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 required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException: Permission denied" This is what I am doing. we had an app that...
0
9718
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10613
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10363
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10107
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5544
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.