Click here to Skip to main content
15,919,931 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionScheduled task Pin
Jassim Rahma3-Oct-10 9:31
Jassim Rahma3-Oct-10 9:31 
AnswerRe: Scheduled task Pin
Not Active3-Oct-10 10:15
mentorNot Active3-Oct-10 10:15 
GeneralRe: Scheduled task [modified] Pin
NeverHeardOfMe3-Oct-10 10:31
NeverHeardOfMe3-Oct-10 10:31 
GeneralRe: Scheduled task Pin
Not Active3-Oct-10 10:44
mentorNot Active3-Oct-10 10:44 
AnswerRe: Scheduled task Pin
Luc Pattyn3-Oct-10 10:23
sitebuilderLuc Pattyn3-Oct-10 10:23 
Questionpopulate from email to database Pin
Jassim Rahma3-Oct-10 7:33
Jassim Rahma3-Oct-10 7:33 
AnswerRe: populate from email to database Pin
Daniel Casserly3-Oct-10 9:19
Daniel Casserly3-Oct-10 9:19 
Questionhelp if anbody can? Pin
ramneek.20083-Oct-10 0:10
ramneek.20083-Oct-10 0:10 
i want to convert a aspx web form into image file.but an error out of memory is occur when i execute following code.




using System;

using System.Data;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.Diagnostics;

using System.Drawing.Imaging;

using System.Drawing;

using System.Drawing.Drawing2D;

using System.IO;



public class CaptureWebPage

{

private const string EXTRACTIMAGE_EXE = "IECapt.exe";

private const int TIMEOUT = 60000;

private const string TMP_NAME = "InBetween.png";



public CaptureWebPage()

{

}



private void Shot(string url, string rootDir)

{

Process p = new Process();

p.StartInfo.FileName = rootDir + "\\" + EXTRACTIMAGE_EXE;

p.StartInfo.Arguments = String.Format("\"{0}\" \"{1}\"", url, rootDir + "\\" + TMP_NAME);

p.StartInfo.UseShellExecute = false;

p.StartInfo.CreateNoWindow = false;

p.Start();

p.WaitForExit();

p.Dispose();

}



private System.Drawing.Image Scale(System.Drawing.Image imgPhoto,int Width, int Height)

{

int srcWidth = imgPhoto.Width;

int srcHeight = imgPhoto.Height;

int srcX = 0; int srcY = 0;

int destX = 0; int destY = 0;



float percent = 0; float percentWidth = 0; float percentHeight = 0;



percentWidth = ((float)Width / (float)srcWidth);

percentHeight = ((float)Height / (float)srcHeight);



if (percentHeight < percentWidth)

{

percent = percentWidth;

destY = 0;

}

else

{

percent = percentHeight;

destX = 0;

}



int destWidth = (int)(srcWidth * percent);

int destHeight = (int)(srcHeight * percent);



System.Drawing.Bitmap pnghoto = new System.Drawing.Bitmap(Width,

Height, PixelFormat.Format24bppRgb);

pnghoto.SetResolution(imgPhoto.HorizontalResolution,

imgPhoto.VerticalResolution);



Graphics grPhoto = Graphics.FromImage(pnghoto);

grPhoto.InterpolationMode =

InterpolationMode.HighQualityBicubic;



grPhoto.DrawImage(imgPhoto,

new Rectangle(destX, destY, destWidth, destHeight),

new Rectangle(srcX, srcY, srcWidth, srcHeight),

GraphicsUnit.Pixel);



grPhoto.Dispose();

return pnghoto;

}



public string GetImage(string url, string name, string rootDir, int width, int height)

{

string fileName = rootDir + "\\" + TMP_NAME;

Shot(url, rootDir);

System.Drawing.Image thumbImage = System.Drawing.Image.FromFile(fileName);

Scale(thumbImage, width, height);

System.Drawing.Image scaledImg = Scale(thumbImage, width, height);

fileName = rootDir + "\\" + name + ".png";

if (File.Exists(fileName))

File.Delete(fileName);

scaledImg.Save(fileName, ImageFormat.Png);

return name + ".png";

}

}
protected void btnsave_Click(object sender,EventArgs e)
{


int Width, Height;

Width = Convert.ToInt32("1000");

Height = Convert.ToInt32("1000");

CaptureWebPage cwp = new CaptureWebPage();
string str="http://localhost:1108/bijliboardwap/showdetail.aspx?meterid="+meterid;

string imagePath = cwp.GetImage(str, " ", Server.MapPath("~"), Width, Height);

Response.Redirect("~/Default2.aspx?Path=" + imagePath);
}
AnswerRe: help if anbody can? Pin
Luc Pattyn3-Oct-10 3:00
sitebuilderLuc Pattyn3-Oct-10 3:00 
Questionhow to do this in Google Pin
Jassim Rahma2-Oct-10 21:24
Jassim Rahma2-Oct-10 21:24 
AnswerRe: how to do this in Google Pin
Brij3-Oct-10 2:49
mentorBrij3-Oct-10 2:49 
AnswerRe: how to do this in Google Pin
Luc Pattyn3-Oct-10 3:12
sitebuilderLuc Pattyn3-Oct-10 3:12 
AnswerRe: how to do this in Google Pin
NeverHeardOfMe3-Oct-10 3:33
NeverHeardOfMe3-Oct-10 3:33 
QuestionAllow web users to get a report on the status of my web service Pin
SummerBulb2-Oct-10 9:35
SummerBulb2-Oct-10 9:35 
AnswerRe: Allow web users to get a report on the status of my web service Pin
Not Active2-Oct-10 9:42
mentorNot Active2-Oct-10 9:42 
GeneralRe: Allow web users to get a report on the status of my web service Pin
SummerBulb2-Oct-10 10:33
SummerBulb2-Oct-10 10:33 
GeneralRe: Allow web users to get a report on the status of my web service Pin
Not Active2-Oct-10 11:29
mentorNot Active2-Oct-10 11:29 
AnswerRe: Allow web users to get a report on the status of my web service Pin
Luc Pattyn2-Oct-10 11:13
sitebuilderLuc Pattyn2-Oct-10 11:13 
QuestionSet focus on row after edit Pin
treuveni2-Oct-10 8:34
treuveni2-Oct-10 8:34 
AnswerRe: Set focus on row after edit Pin
Not Active2-Oct-10 9:47
mentorNot Active2-Oct-10 9:47 
GeneralRe: Set focus on row after edit Pin
treuveni3-Oct-10 5:53
treuveni3-Oct-10 5:53 
GeneralRe: Set focus on row after edit Pin
Daniel Casserly3-Oct-10 9:22
Daniel Casserly3-Oct-10 9:22 
QuestionAjax problem Pin
Jassim Rahma1-Oct-10 12:18
Jassim Rahma1-Oct-10 12:18 
AnswerRe: Ajax problem Pin
Brij1-Oct-10 18:09
mentorBrij1-Oct-10 18:09 
GeneralRe: Ajax problem Pin
Jassim Rahma2-Oct-10 7:54
Jassim Rahma2-Oct-10 7:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.