Tuesday, June 24, 2008

New material from Abby

How to call Captcha Image code on page
First add a new web page and add below code in his code behinde


#region <------------------------------ Directories---------------------------------------->
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
#endregion
//This page is used to generate CaptchaImage which is randomly changed when user at SignUp1 page
public partial class Users_JPEGImage : System.Web.UI.Page
{
#region <--------------------------Page Load ---------------------------------->
protected void Page_Load(object sender, EventArgs e)
{
// Create a CAPTCHA image using the text stored in the Session object.
randomImage ci = new randomImage(this.Session["CaptchaImageText"].ToString(), 200, 50, "Century Schoolbook");
// Change the response headers to output a JPEG image.
this.Response.Clear();
this.Response.ContentType = "image/jpeg";
// Write the image to the response stream in JPEG format.
ci.Image.Save(this.Response.OutputStream, ImageFormat.Jpeg);
// Dispose of the CAPTCHA image object.
ci.Dispose();
}
#endregion
}

3 comments:

Anonymous said...

Hi this is a good link

Unknown said...

sir i want what is the process of doing urlrewrite in asp.net

Abhishek Verma said...

ContentPlaceHolder Maincontent = (ContentPlaceHolder)Page.Master.FindControl("ContentPlaceHolder1");
FlightSearchResult uc = (FlightSearchResult)Maincontent.FindControl("Flightsearch");
GridView gdHotel = uc.grdFlight1;