refer these sites
http://www.dotnetfunda.com/articles/article509-paging--for-first-next-previous-and-last-in-gridview-.aspx
and
http://www.netomatix.com/development/gridviewpaging.aspx
Dec 21, 2009
Dec 20, 2009
upload single file and multiple files in C#.net
Upload single file and multiple files
see the link below.
http://msdn.microsoft.com/en-us/library/aa478971.aspx
see the link below.
http://msdn.microsoft.com/en-us/library/aa478971.aspx
Dec 17, 2009
solution of system.security.permissions.securitypermissions
system.security.permissions.securitypermissions
whatever we are using paymentgateways, some opensource library's are working in local systems but they are not working in godaddy.com.
if this type issue is faced please chk the following regions
-permissions based,(set the permissions in godaddy)
-Paymentgateway,(all paymentgateway's are not supported)
-CDO mail object,(in godaddy using 'system.web.mail'/smtp mail is used to sending mails)
-some opensource library's(if all permissions have then only u can use)
whatever we are using paymentgateways, some opensource library's are working in local systems but they are not working in godaddy.com.
if this type issue is faced please chk the following regions
-permissions based,(set the permissions in godaddy)
-Paymentgateway,(all paymentgateway's are not supported)
-CDO mail object,(in godaddy using 'system.web.mail'/smtp mail is used to sending mails)
-some opensource library's(if all permissions have then only u can use)
Errrr: Specified Protocol is unknown
Specified Protocol is unknown.
solution: mention namespace of CDO .it is related to CDO object
solution: mention namespace of CDO .it is related to CDO object
Dec 11, 2009
How to zip multiple files in c#,asp.net
using opensource(sharpziplib)
downloading dll in the following link
http://www.icsharpcode.net/OpenSource/SharpZipLib/Download.aspx
add the dll and using the below namespaces
//Namespaces
using ICSharpCode.SharpZipLib.Zip;
using ICSharpCode.SharpZipLib.Checksums;
code:
Crc32 crc = new Crc32();
ZipOutputStream s = new ZipOutputStream(File.Create(@"c:\newfile.zip"));
s.SetLevel(9); // 0 - store only to 9 - means best compression
ZipEntry entry = null;
String[] str = new String[] { "Ads.xml", "Ads1.xml" };
byte[] buffer = null;
for (int i = 0; i < str.Length; i++)
{
FileStream fs = File.OpenRead(@"c:\" + str[i]);
buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
entry = new ZipEntry(ZipEntry.CleanName(@"c:\" + str[i]));
entry.DateTime = DateTime.Now;
entry.Comment = "test file";
entry.ZipFileIndex = i;
entry.Size = fs.Length;
fs.Close();
crc.Reset();
crc.Update(buffer);
entry.Crc = crc.Value;
s.PutNextEntry(entry);
s.Write(buffer, 0, buffer.Length);
}
s.Finish();
s.Close();
downloading dll in the following link
http://www.icsharpcode.net/OpenSource/SharpZipLib/Download.aspx
add the dll and using the below namespaces
//Namespaces
using ICSharpCode.SharpZipLib.Zip;
using ICSharpCode.SharpZipLib.Checksums;
code:
Crc32 crc = new Crc32();
ZipOutputStream s = new ZipOutputStream(File.Create(@"c:\newfile.zip"));
s.SetLevel(9); // 0 - store only to 9 - means best compression
ZipEntry entry = null;
String[] str = new String[] { "Ads.xml", "Ads1.xml" };
byte[] buffer = null;
for (int i = 0; i < str.Length; i++)
{
FileStream fs = File.OpenRead(@"c:\" + str[i]);
buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
entry = new ZipEntry(ZipEntry.CleanName(@"c:\" + str[i]));
entry.DateTime = DateTime.Now;
entry.Comment = "test file";
entry.ZipFileIndex = i;
entry.Size = fs.Length;
fs.Close();
crc.Reset();
crc.Update(buffer);
entry.Crc = crc.Value;
s.PutNextEntry(entry);
s.Write(buffer, 0, buffer.Length);
}
s.Finish();
s.Close();
How to set Tabindex in asp.net application
in the Page_Load
page.form.defaultfocus=button.clientid;
page.form.defaultbutton=button.uniqueid;
page.form.defaultfocus=button.clientid;
page.form.defaultbutton=button.uniqueid;
Dec 9, 2009
Access to the path c :\inetpub\wwwroot\foldername\file is denied
Error: Access to the path c :\inetpub\wwwroot\foldername\file is denied.
Solution: give access permissions in the iis.
steps:
Open c:\inetpub\wwwroot\ur application folder, in that open folder, where ur storing the files.
right click on the folder, select properties option, click security tab.
In that click add button to create 'ASPNET' user and allow all permissions.
and remaining users like(system,iisusers) also allow permissions.
It will work....
Solution: give access permissions in the iis.
steps:
Open c:\inetpub\wwwroot\ur application folder, in that open folder, where ur storing the files.
right click on the folder, select properties option, click security tab.
In that click add button to create 'ASPNET' user and allow all permissions.
and remaining users like(system,iisusers) also allow permissions.
It will work....
Dec 2, 2009
How to Connect our site to paypal
connect our website to paypal site.
it is very easy to connect to paypal.
steps to connect
Create a merchant account in paypal.
open the paypal account with your existing id.
goto my account in that select merchant optioin.
there it showing different types of buttons like(buy,donate,addtocart)
select which one u have to use.
complete the remaining fields. after filling all thefields automatically script will be generated.
Copy the code and paste in ur page.
it works...
it is very easy to connect to paypal.
steps to connect
Create a merchant account in paypal.
open the paypal account with your existing id.
goto my account in that select merchant optioin.
there it showing different types of buttons like(buy,donate,addtocart)
select which one u have to use.
complete the remaining fields. after filling all thefields automatically script will be generated.
Copy the code and paste in ur page.
it works...
Nov 30, 2009
Could not load file c:\inetpub\wwwroot\..
Error : Could not load file c:\inetpub\wwwroot\..
Solution: Issue is related to permission .give the (ASPNET)user permissions.
Solution: Issue is related to permission .give the (ASPNET)user permissions.
Nov 24, 2009
Create a Word document in asp.net
By using StringBuilder, create word doucment
StringBuilder strbuild = new StringBuilder();
strbuild.Append("".ToString());
".ToString());
FileStream file = new FileStream(strpath, FileMode.Create);
file.Close();
StreamWriter stw = new StreamWriter(strpath);
stw.Write(strbuild);
stw.Close();
StringBuilder strbuild = new StringBuilder();
strbuild.Append("
| FirstName : ".ToString());strbuild.Append(dt.Rows[0]["FirstName"].ToString()); strbuild.Append(" | ".ToString());
FileStream file = new FileStream(strpath, FileMode.Create);
file.Close();
StreamWriter stw = new StreamWriter(strpath);
stw.Write(strbuild);
stw.Close();
zip multiple files using C#.net
create a zip file using c#.net.
Code:
addfiletozip(destinationfile,sourcefile);
private static void AddFileToZip(string zipFilename, string fileToAdd)
{
using (Package zip = System.IO.Packaging.Package.Open(zipFilename, FileMode.OpenOrCreate))
{
string destFilename = "./Documents/" + Path.GetFileName(fileToAdd);
Uri uri = PackUriHelper.CreatePartUri(new Uri(destFilename, UriKind.Relative));
if (zip.PartExists(uri))
{
zip.DeletePart(uri);
}
PackagePart part = zip.CreatePart(uri, "", CompressionOption.Normal);
using (FileStream fileStream = new FileStream(fileToAdd, FileMode.Open, FileAccess.Read))
{
using (Stream dest = part.GetStream())
{
CopyStream(fileStream, dest);
}
}
}
}
private static void CopyStream(System.IO.FileStream inputStream, System.IO.Stream outputStream)
{
long bufferSize = inputStream.Length < class="blsp-spelling-error" id="SPELLING_ERROR_39">inputStream.Length : BUFFER_SIZE;
byte[] buffer = new byte[bufferSize];
int bytesRead = 0;
long bytesWritten = 0;
while ((bytesRead = inputStream.Read(buffer, 0, buffer.Length)) != 0)
{
outputStream.Write(buffer, 0, bytesRead);
bytesWritten += bufferSize;
}
}
Code:
addfiletozip(destinationfile,sourcefile);
private static void AddFileToZip(string zipFilename, string fileToAdd)
{
using (Package zip = System.IO.Packaging.Package.Open(zipFilename, FileMode.OpenOrCreate))
{
string destFilename = "./Documents/" + Path.GetFileName(fileToAdd);
Uri uri = PackUriHelper.CreatePartUri(new Uri(destFilename, UriKind.Relative));
if (zip.PartExists(uri))
{
zip.DeletePart(uri);
}
PackagePart part = zip.CreatePart(uri, "", CompressionOption.Normal);
using (FileStream fileStream = new FileStream(fileToAdd, FileMode.Open, FileAccess.Read))
{
using (Stream dest = part.GetStream())
{
CopyStream(fileStream, dest);
}
}
}
}
private static void CopyStream(System.IO.FileStream inputStream, System.IO.Stream outputStream)
{
long bufferSize = inputStream.Length < class="blsp-spelling-error" id="SPELLING_ERROR_39">inputStream.Length : BUFFER_SIZE;
byte[] buffer = new byte[bufferSize];
int bytesRead = 0;
long bytesWritten = 0;
while ((bytesRead = inputStream.Read(buffer, 0, buffer.Length)) != 0)
{
outputStream.Write(buffer, 0, bytesRead);
bytesWritten += bufferSize;
}
}
Oct 12, 2009
Cannot open database 'db1' . Login Failed by username 'system name/Aspnet'
Error :
Cannot open database 'db1' . Login Failed by username 'system name/Aspnet'
Solution :
Create Aspnet user in sqlserver security, and give permission to the selected database.(select db_owner option)
Cannot open database 'db1' . Login Failed by username 'system name/Aspnet'
Solution :
Create Aspnet user in sqlserver security, and give permission to the selected database.(select db_owner option)
Operating System compatability Error in installation of Sql Server 2005 Enterprise edition
Error :
Operating System compatability Error is occurred
in installation of Sql Server 2005 Enterprise edition.
in windows xp SP3.
Solution: Use Sql server Developer Edition.
Operating System compatability Error is occurred
in installation of Sql Server 2005 Enterprise edition.
in windows xp SP3.
Solution: Use Sql server Developer Edition.
Confugaration Error: Could not load file or assembly "'CrystalDecisions.CrystalReports.Engine,
Error :
Could not load file or assembly "'CrystalDecisions.CrystalReports.Engine, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
Solution:
http://www.filewatcher.com/m/CRRedist2005_x86.msi.16971776.0.0.html
Using the above link to download CrystalInstaller.exe file and Install.
Crystal Reports will work..
Could not load file or assembly "'CrystalDecisions.CrystalReports.Engine, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
Solution:
http://www.filewatcher.com/m/CRRedist2005_x86.msi.16971776.0.0.html
Using the above link to download CrystalInstaller.exe file and Install.
Crystal Reports will work..
Sep 22, 2009
Unrecognized attribute 'Type'
Error : Unrecognized attribute 'Type'
Solution: Change the framework version 1.0 to 2.0 in virtual directory.
In IIS virtual directory right click go to properties,select asp.net tab there u change
framework version 1.0 to 2.0. click apply.
Now it will work..
Solution: Change the framework version 1.0 to 2.0 in virtual directory.
In IIS virtual directory right click go to properties,select asp.net tab there u change
framework version 1.0 to 2.0. click apply.
Now it will work..
Sep 17, 2009
Error: Xml page cannot be displayed
Error :
Xml Page cannot be displayed,
Cannot view xml input using XSL Style sheet. Please correct the error and click the refresh button.
solution:
If u register IIS reinstall that one
goto visula studio command promt and
using command : aspnet_regiis -u
after that register IIS
command : aspnet_regiis -i
Xml Page cannot be displayed,
Cannot view xml input using XSL Style sheet. Please correct the error and click the refresh button.
solution:
If u register IIS reinstall that one
goto visula studio command promt and
using command : aspnet_regiis -u
after that register IIS
command : aspnet_regiis -i
Login Failed For user MachineName/Aspnet
if ur using local system
Create a ASPNET user in sqlserver(windows 2000 and xp) and give db_owner credentials
if ur using remote server
Create NetworkUser (windows server 2003) and give db_owner credentials.
Create a ASPNET user in sqlserver(windows 2000 and xp) and give db_owner credentials
if ur using remote server
Create NetworkUser (windows server 2003) and give db_owner credentials.
Sep 1, 2009
Important Links
.Net certification Links:
http://www.dotnetspider.com/sites/423/-DumpsForMicrosoftCertification.aspx
Sharepoint links:
http://blog.sharepointhosting.com/Downloads/SharePoint-Tutorials.aspx
http://www.dotnetspider.com/sites/393/CommunityAttachments.aspx
http://www.dotnetspider.com/sites/333/CommunityAttachments.aspx
http://www.dotnetspider.com/sites/7/CommunityAttachments.aspx
http://www.dotnetspider.com/sites/423/-DumpsForMicrosoftCertification.aspx
http://www.dotnetspider.com/sites/423/Forum-936-Dums-for--Part-II.aspx
http://www.dotnetspider.com/sites/423/-DumpsForMicrosoftCertification.aspx
Sharepoint links:
http://blog.sharepointhosting.com/Downloads/SharePoint-Tutorials.aspx
http://www.dotnetspider.com/sites/393/CommunityAttachments.aspx
http://www.dotnetspider.com/sites/333/CommunityAttachments.aspx
http://www.dotnetspider.com/sites/7/CommunityAttachments.aspx
http://www.dotnetspider.com/sites/423/-DumpsForMicrosoftCertification.aspx
http://www.dotnetspider.com/sites/423/Forum-936-Dums-for--Part-II.aspx
Aug 25, 2009
Delete records from multiple tables
In creation of table u have to do like this
ALTER TABLE tablename
ADD CONSTRAINT constraintname FOREIGN KEY (columnname(s))
REFERENCES referencedtablename (columnname(s))
ON DELETE CASCADE;
otherwise,
rightclick on childtable, go to modify then right click on foreign key column -click relationships
- expand Insert/Update specifications - set delete specification property as "CASCADE"..
its working....
Aug 23, 2009
Useful Links
export to excel in sqlserver
http://blog.sqlauthority.com/2008/01/08/sql-server-2005-export-data-from-sql-server-2005-to-microsoft-excel-datasheet/
http://www.codeguru.com/columns/dotnet/article.php/c6027
http://www.dotnetcurry.com/ShowArticle.aspx?ID=126&AspxAutoDetectCookieSupport=1
create exe file:
http://balanagaraj.wordpress.com/2007/05/29/create-exe-or-setup-file-in-net-windows-application/
http://www.breakingpar.com/bkp/home.nsf/0/CA99375CC06FB52687256AFB0013E5E9
cursors:
http://techrepublic.com.com/5208-6230-0.html?forumID=101&threadID=204486&start=0
wizard controls
http://www.beansoftware.com/ASP.NET-Tutorials/Wizard-Control-ASP.Net-2.0.aspx
dropdownlist in gridview
http://www.byteblocks.com/page/How-to-insert-DropdownList-control-in-GridView.aspx
Bookmark Link
http://www.tildemark.com/programming/javascript/adding-bookmark-this-to-your-website-using-javascr.html
Chrat Controls
http://bhopu.com/2009/06/aspnet/
Dynamic Checkboxes
http://dotnetfaqs-edu.blogspot.com/2009/01/generate-dynamic-checkbox-in-aspnet.html
blog
http://dotnetf1.blogspot.com/2008/07/how-to-merge-cells-in-excel-while.html
http://blog.sqlauthority.com/2008/01/08/sql-server-2005-export-data-from-sql-server-2005-to-microsoft-excel-datasheet/
http://www.codeguru.com/columns/dotnet/article.php/c6027
http://www.dotnetcurry.com/ShowArticle.aspx?ID=126&AspxAutoDetectCookieSupport=1
create exe file:
http://balanagaraj.wordpress.com/2007/05/29/create-exe-or-setup-file-in-net-windows-application/
http://www.breakingpar.com/bkp/home.nsf/0/CA99375CC06FB52687256AFB0013E5E9
cursors:
http://techrepublic.com.com/5208-6230-0.html?forumID=101&threadID=204486&start=0
wizard controls
http://www.beansoftware.com/ASP.NET-Tutorials/Wizard-Control-ASP.Net-2.0.aspx
dropdownlist in gridview
http://www.byteblocks.com/page/How-to-insert-DropdownList-control-in-GridView.aspx
Bookmark Link
http://www.tildemark.com/programming/javascript/adding-bookmark-this-to-your-website-using-javascr.html
Chrat Controls
http://bhopu.com/2009/06/aspnet/
Dynamic Checkboxes
http://dotnetfaqs-edu.blogspot.com/2009/01/generate-dynamic-checkbox-in-aspnet.html
blog
http://dotnetf1.blogspot.com/2008/07/how-to-merge-cells-in-excel-while.html
Aug 19, 2009
Creating different sheets in workbook
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/08d69589-4052-410f-a85c-c38493c0a664
May 27, 2009
Data read from xml
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("AlertTemplate.xml"));
DataView dv = new DataView(ds.Tables[0]);
string template = dv[0]["AlertTemplate"].ToString().Trim();
template = template.Replace("#Inventor1#", Name);
template = template.Replace("#ApplicationNo#", Application);
ds.Dispose();
In xml file :
write within alerttemplate tags
ds.ReadXml(Server.MapPath("AlertTemplate.xml"));
DataView dv = new DataView(ds.Tables[0]);
string template = dv[0]["AlertTemplate"].ToString().Trim();
template = template.Replace("#Inventor1#", Name);
template = template.Replace("#ApplicationNo#", Application);
ds.Dispose();
In xml file :
write within alerttemplate tags
May 21, 2009
DoPostBackWithOptinshelp
Whenever we are using calender extender control this postback error is cming..
set the attribute in button event is
causesValidation = "false"
its works perfect.
set the attribute in button event is
causesValidation = "false"
its works perfect.
May 18, 2009
Rating Star
using rating contrl in ajax
cc1:Rating id="Rating1" runat="server" CurrentRating="0"
EmptyStarCssClass="emptyRatingStar"
FilledStarCssClass="filledRatingStar"
WaitingStarCssClass="savedRatingStar"
StarCssClass="ratingStar" MaxRating="5" OnChanged="Rating_Changed" AutoPostBack="True" >/cc1:Rating>
/// Rating changes event\\
protected void Rating_Changed(object sender, AjaxControlToolkit.RatingEventArgs e)
{
Response.Redirect("RateBusiness.aspx?t=" + HttpUtility.UrlEncode( lblTitle.Text) + "&id=" + Request.QueryString["id"].ToString());
}
cc1:Rating id="Rating1" runat="server" CurrentRating="0"
EmptyStarCssClass="emptyRatingStar"
FilledStarCssClass="filledRatingStar"
WaitingStarCssClass="savedRatingStar"
StarCssClass="ratingStar" MaxRating="5" OnChanged="Rating_Changed" AutoPostBack="True" >/cc1:Rating>
/// Rating changes event\\
protected void Rating_Changed(object sender, AjaxControlToolkit.RatingEventArgs e)
{
Response.Redirect("RateBusiness.aspx?t=" + HttpUtility.UrlEncode( lblTitle.Text) + "&id=" + Request.QueryString["id"].ToString());
}
Captcha Code
security code:
page_load event
{
string checkCode = this.CreateRandomCode(6);
Session["CheckCode"] = checkCode;
CreateImage(checkCode);
}
public string CreateRandomCode(int codeCount)
{
string allChar = "0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
string[] allCharArray = allChar.Split(',');
string randomCode = "";
int temp = -1;
Random rand = new Random();
for (int i = 0; i < codeCount; i++)
{
if (temp != -1)
{
rand = new Random(i * temp * ((int)DateTime.Now.Ticks));
}
int t = rand.Next(36);
if (temp != -1 && temp == t)
{
return CreateRandomCode(codeCount);
}
temp = t;
randomCode += allCharArray[t];
}
return randomCode;
}
private void CreateImage(string checkCode)
{
System.Drawing.Bitmap image = new System.Drawing.Bitmap(Convert.ToInt32(Math.Ceiling((decimal)(checkCode.Length * 14))), 22);
Graphics g = Graphics.FromImage(image);
try
{
Random random = new Random();
g.Clear(Color.AliceBlue);
for (int i = 0; i < 25; i++)
{
int x1 = random.Next(image.Width);
int x2 = random.Next(image.Width);
int y1 = random.Next(image.Height);
int y2 = random.Next(image.Height);
g.DrawLine(new Pen(Color.Silver), x1, y1, x2, y2);
}
Font font = new System.Drawing.Font("Comic Sans MS", 12, System.Drawing.FontStyle.Bold);
System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(new Rectangle(0, 0, image.Width, image.Height), Color.Blue, Color.DarkRed, 1.2f, true);
g.DrawString(checkCode, font, new SolidBrush(Color.Black), 2, 2);
for (int i = 0; i < 100; i++)
{
int x = random.Next(image.Width);
int y = random.Next(image.Height);
image.SetPixel(x, y, Color.FromArgb(random.Next()));
}
g.DrawRectangle(new Pen(Color.Silver), 0, 0, image.Width - 1, image.Height - 1);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
image.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
Response.ClearContent();
Response.ContentType = "image/Gif";
Response.BinaryWrite(ms.ToArray());
}
finally
{
g.Dispose();
image.Dispose();
}
}
}
The Above code is created in one file..
wherever we want this captcha code page . using 'IFrame' to use... in any other page
iframe runat ="server" id="IfrmCapcha" src="Capcha.aspx" height="50px" width="150px" scrolling="no">/iframe>
page_load event
{
string checkCode = this.CreateRandomCode(6);
Session["CheckCode"] = checkCode;
CreateImage(checkCode);
}
public string CreateRandomCode(int codeCount)
{
string allChar = "0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
string[] allCharArray = allChar.Split(',');
string randomCode = "";
int temp = -1;
Random rand = new Random();
for (int i = 0; i < codeCount; i++)
{
if (temp != -1)
{
rand = new Random(i * temp * ((int)DateTime.Now.Ticks));
}
int t = rand.Next(36);
if (temp != -1 && temp == t)
{
return CreateRandomCode(codeCount);
}
temp = t;
randomCode += allCharArray[t];
}
return randomCode;
}
private void CreateImage(string checkCode)
{
System.Drawing.Bitmap image = new System.Drawing.Bitmap(Convert.ToInt32(Math.Ceiling((decimal)(checkCode.Length * 14))), 22);
Graphics g = Graphics.FromImage(image);
try
{
Random random = new Random();
g.Clear(Color.AliceBlue);
for (int i = 0; i < 25; i++)
{
int x1 = random.Next(image.Width);
int x2 = random.Next(image.Width);
int y1 = random.Next(image.Height);
int y2 = random.Next(image.Height);
g.DrawLine(new Pen(Color.Silver), x1, y1, x2, y2);
}
Font font = new System.Drawing.Font("Comic Sans MS", 12, System.Drawing.FontStyle.Bold);
System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(new Rectangle(0, 0, image.Width, image.Height), Color.Blue, Color.DarkRed, 1.2f, true);
g.DrawString(checkCode, font, new SolidBrush(Color.Black), 2, 2);
for (int i = 0; i < 100; i++)
{
int x = random.Next(image.Width);
int y = random.Next(image.Height);
image.SetPixel(x, y, Color.FromArgb(random.Next()));
}
g.DrawRectangle(new Pen(Color.Silver), 0, 0, image.Width - 1, image.Height - 1);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
image.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
Response.ClearContent();
Response.ContentType = "image/Gif";
Response.BinaryWrite(ms.ToArray());
}
finally
{
g.Dispose();
image.Dispose();
}
}
}
The Above code is created in one file..
wherever we want this captcha code page . using 'IFrame' to use... in any other page
iframe runat ="server" id="IfrmCapcha" src="Capcha.aspx" height="50px" width="150px" scrolling="no">/iframe>
Forms Authentication
mention in web.config file within authentication tags
authentication mode="Forms"
forms name=".BIZAUTH" loginUrl="~/loginform.aspx" defaultUrl="~/Private/MyAccount.aspx" timeout="20" >/forms>
/authentication>
authentication mode="Forms"
forms name=".BIZAUTH" loginUrl="~/loginform.aspx" defaultUrl="~/Private/MyAccount.aspx" timeout="20" >/forms>
/authentication>
ICallBackEventHandler
example:
public partial class BusinessesList : System.Web.UI.Page,System.Web.UI.ICallbackEventHandler(Inherit to class)
string callBackReference = ClientScript.GetCallbackEventReference(this, "arg", "ReciveServerResponse", "context");
string callBackScript = "function CallServer(arg,context){" + callBackReference + ";}";
ClientScript.RegisterClientScriptBlock(this.GetType(), "CallServer", callBackScript, true);
/// javascript//
public partial class BusinessesList : System.Web.UI.Page,System.Web.UI.ICallbackEventHandler(Inherit to class)
string callBackReference = ClientScript.GetCallbackEventReference(this, "arg", "ReciveServerResponse", "context");
string callBackScript = "function CallServer(arg,context){" + callBackReference + ";}";
ClientScript.RegisterClientScriptBlock(this.GetType(), "CallServer", callBackScript, true);
/// javascript//
Modal Popup Extender
Ajax modal popup extender
//javascript//
function OnOK()
{
__doPostBack('ctl00$cphBody$btnOK','')
}
cc1:ModalPopupExtender ID="ModalPopupExtender1" OkControlID="btnOK" CancelControlID="btnCancel" runat="server" PopupControlID="CustomPreferencePopup" TargetControlID="lnk" BackgroundCssClass="watermarked" DropShadow="true" OnOkScript="OnOK();">
/cc1:ModalPopupExtender>
//javascript//
function OnOK()
{
__doPostBack('ctl00$cphBody$btnOK','')
}
cc1:ModalPopupExtender ID="ModalPopupExtender1" OkControlID="btnOK" CancelControlID="btnCancel" runat="server" PopupControlID="CustomPreferencePopup" TargetControlID="lnk" BackgroundCssClass="watermarked" DropShadow="true" OnOkScript="OnOK();">
/cc1:ModalPopupExtender>
Subscribe to:
Posts (Atom)