I'm trying to insert an image into a PDF, when I'm creating it. It works fine at localhost. But when I try i on server, it crash at the line of inserting image.
I've tried with:
Dim stream As IO.Stream = IO.File.Open(Server.MapPath("~/Imagenes/Cabeceras/LogoPresfiap.jpg"), IO.FileMode.Open)or
Dim stream As IO.Stream = IO.File.Open(Server.MapPath("~/../../Cabeceras/LogoPresfiap.jpg"), IO.FileMode.Open)No sucess. It throws me an error Acces denied:
I am using ASP.NET 3.5 with iTextSharp and I have the following code:
var templatePath = Server.MapPath(@"~/Templates/template1.pdf"); var newFilePath = Server.MapPath(@"~/TempFiles/new.pdf"); PdfReader pdfReader = new PdfReader(templatePath); PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(newFilePath, FileMode.Create)); AcroFields pdfFormFields = pdfStamper.AcroFields; pdfFormFields.SetField("Box1", "007"); pdfFormFields.SetField("Box2", "123456"); pdfStamper.FormFlattening = false; pdfStamper.Close(); Response.ClearContent(); Response.Buffer = true; Response.ContentType = "application/pdf"; Response.AddHeader("Content-Disposition", "attachment;filename=new.pdf")); Response.WriteFile(newFilePath); Response.End();
The above code fills out a pdf file and saves the new file to the TempFiles folder. It then prompts the user to either save or open the file. Can I achieve the same functionality without saving the file to the TempFiles location?
I have an application that uses its own authorization to determine if a user has access to pages. I want to display a more friendly "access denied" page in the event that access denied. In the MasterPage...
[Code]....
In the web.config
[Code]....
I get the error below. To me it looks like I'm not allowed to, or the error is a result of just trying to instantiate the UnauthorizedAccessException() class,Attempted to perform an unauthorized operation.
Exception Details: System.UnauthorizedAccessException: Attempted to perform an unauthorized operation.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
I need to be able to read an excel file from a file upload control but I can not save the file to disk first, it must be done in memory.
[Code]....
Above is my code for reading the data file if it IS saved to disk, but again, I have to be able to do this without saving the file to disk, it must be done in memory. I have not been able to find any sample code anywhere on how to do this from memory, everything seems to force the file be uploaded, saved to disk, and then read in the connection string, which again I can not do.
I have a css file which I want to read from disk and in that content I want to find and replace all linebreaks (do I look for vbCrlf or ...?)
Public Shared Function GetFileContents(ByVal FullFilename As String) As String Dim filecontents As String = "" If File.Exists(FullFilename) Then Dim objStreamReader As StreamReader objStreamReader = File.OpenText(FullFilename) filecontents = objStreamReader.ReadToEnd() objStreamReader.Close() End If Return filecontents End Function
So in the returned variable "filecontents" I want to find and replace any linebreaks.
I've a view which display all data. I'm using ViewData, for loop etc.. on the view, to show the data. It may sound weird, but is it possible to write view to disk as a file instead of showing in the browser. The reason is that, business wants functionality to send the same view file as email attachment to the user.
How to save Ajax Editor content as an HTML file to a disk?
Let's say I have an Ajax Editor which allows user to type or paste in long message or writting. Once he clicks on "submit" button, an HTML file will be created and save to a disk. I am working on asp.net 3.5, ajax version 3.5 (from codeplex, work well).
I'm using ASP.NET for file uploads, and I'm hitting a bit of a snag in that data sent by the client as multipart form data is read straight into RAM.
Obviously, this means maximum file upload size is limited to the available RAM on the machine, and even then is much smaller as soon as you have multiple simultaneous uploads.
Is it possible to get ASP.NET to write the data to a temporary file on the hard drive as it is recieved rather than reading into RAM?
What are the options for handling file uploads to reduce the memory footprint? Is there a way to upload in chunks? Is there a way to stream upload directly to disk instead of loading entire file in server memory?
i need to save multiple documents stored in SQL server as Image type to disk.
What i want to do is "backup" all files in a table (column) to disk, zip them and Response.TransmitFile(FilePath) to client.
I could use C# ot VB but that would require a lot of connections to database or a lot of server memory and i don't want that, becauze there are a lot of files to be saved Since SQL can write files to disk i was thinking about saving those files to disk directly from sql. Something like when u're doing a backup
I have an httpmodule and it has a handler for OnEndRequest. I am trying to write the HttpContext.Response.OutputStream to a file. I am trying to use the Read method of it. But when it is called the exception message i get is "Specified method is not supported". So i am not able to do what i want that is, write the response to a file on the disk. I am able to write the HttpContext.Request.InputStream to a file using its Read method which i do in a handler for OnBeginRequest.
I m trying to read the tags of a local HTML file. I found out this code online but it works for the aspx pages on the server and of the current app only. ___________________________________________________
using System.Web.UI.HtmlControls;
foreach (Control c in this.Page.Header.Controls)
{ if (c.GetType() == typeof(HtmlMeta))[code]...
THis code acceses the following section of an html page -
My website provides a facility to upload images, using the ASP.NET FileUpload control. We accept both jpeg and tiff formats but I have just decided that all tiffs should be converted to jpegs at the time of upload. If possible, I want to avoid saving the original tiff to disk. I would any sample coding for achieving this conversion prior to saving (ideally in VB.NET, though I could always run C# code through a converter).
My website provides a facility to upload images, using the ASP.NET FileUpload control. We accept both jpeg and tiff formats but I have just decided that all tiffs should be converted to jpegs at the time of upload. If possible, I want to avoid saving the original tiff to disk.
I would appreciate any sample coding suggestions for achieving this conversion prior to saving (ideally in VB.NET, though I could always run C# code through a converter).
i want to export an excel from my web application and want to save it on Web Server, but i am not able to save it on web server, i am able to do it on my local machine, but on web server it's not working.