السلام عليكم ورحمة الله وبركاته :)
في عمليه ال regestration تظهر صوره بها بعض الحروف العشوائيه للتأكد من عدم ديناميكية عملية التسجيل
كيف اضيف هذه التقنية في صفحتي باستخدام C# oo
ولكم خالص الشكر :wacko:
السلام عليكم ورحمة الله وبركاته :)
في عمليه ال regestration تظهر صوره بها بعض الحروف العشوائيه للتأكد من عدم ديناميكية عملية التسجيل
كيف اضيف هذه التقنية في صفحتي باستخدام C# oo
ولكم خالص الشكر :wacko:
هناك طريقة وهي:
ارسم صورا بها أرقام وحروف
ثم قم بتسمية كل صورة بمحتواها
وعند عملية التسجيل أعطه صورة عشوائية واحفظ اسمها بمتحول
وطابق بينهما عند التسجيل
(رأي شخصي)
أولاً أنشئ ملف وليكن اسمه img.aspx, واكتب في الحث Page_load ما يلي:
Bitmap objBMP = new System.Drawing.Bitmap(60, 20);
Graphics objGraphics = System.Drawing.Graphics.FromImage(objBMP);
objGraphics.Clear(Color.White);
objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias;
//' Configure font to use for text
Font objFont = new Font("Arial", 10, FontStyle.Bold);
//This is to add the string to session cookie, to be compared later
string randomStr = context.Request["sc"];
//' Write out the text
objGraphics.DrawString(randomStr, objFont, Brushes.Black, 3, 3);
//' Set the content type and return the image
context.Response.ContentType = "image/GIF";
objBMP.Save(context.Response.OutputStream, ImageFormat.Gif);
objFont.Dispose();
objGraphics.Dispose();
objBMP.Dispose();في صفحة التسجيل ضمن عنصر صورة كما يلي:
<asp:Image id="imgCode" Runat="server"></asp:Image>
في ملف الـ Code Behind وفي الحدث PageLoad لصفحة التسجيل اكتب:
string randomStr = "";
int[] myIntArray = new int[6];
int x;
//That is to create the random # and add it to our string
Random autoRand = new Random();
for (x = 0; x < 6; x++)
{
myIntArray[x] = System.Convert.ToInt32 (autoRand.Next(0,9));
randomStr += (myIntArray[x].ToString ());
}
imgCode.ImageUrl = "img.aspx?sc=" + randomStr;هذا الموضوع مغلق.
المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية
جارٍ التحقق من المتواجدين…