Solved

create and download file

Posted on 2013-05-17
5
357 Views
Last Modified: 2013-05-25
hi, i have a page that i want when the user click on one button executes this function:

   Private Function CreateImg(ByVal sImage As String,) As System.Drawing.Bitmap

i want when the click happens execute this function and download the image file that is created to the computer of the user asking where the user want to be save.
0
Comment
Question by:rafaelrgl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39175853
What is your question?
0
 
LVL 22

Accepted Solution

by:
Mrunal earned 350 total points
ID: 39175855
0
 
LVL 1

Author Comment

by:rafaelrgl
ID: 39175951
this works for an file on the server:

String FileName = "FileName.txt";
String FilePath = "C:/...."; //Replace this
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.ClearContent();
response.Clear();
response.ContentType = "text/plain";
response.AddHeader("Content-Disposition", "attachment; filename=" + FileName + ";");
response.TransmitFile(FilePath);
response.Flush();
response.End();

what i want is to use the function i mention above that returns an bitmap, convert to file and downloaded. this function downloads an file on the server using path, but i don't have that, i have the function that returns an bitmap.
0
 
LVL 10

Assisted Solution

by:Monica P
Monica P earned 150 total points
ID: 39176725
Hi

Sorry i cannot clearly understood your request

check whether this sample meet your need

http://forums.asp.net/t/631768.aspx/
0
 
LVL 1

Author Comment

by:rafaelrgl
ID: 39177807
i think i was not clear about what's the question, so let me try to explain, i have an webpage that on codebehind i have this function:

  Private Function CreateImg(ByVal sImage As String,) As System.Drawing.Bitmap

but it returns system.drawing.bitmap. what i want is to convert this into a file and download it to the user when the user clicks on a button, lets say:

'get the bitmap
createimg("ldfk")
download the image created to the user in jpg format
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question