PDA

View Full Version : capcha



malihe joon
یک شنبه 20 بهمن 1392, 11:47 صبح
سلام .در حال آپلود کردن فایل هستم که از کپچا ایراد میگیره تو local host اجرامیشه. از این خط ایراد میگیره.میشه زودترمنو راهنمایی کنید؟


string ABC = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890qwertyuiopasdf ghjklzxcvbnm";

Random rand = new Random();

object ABC1 = rand.Next(1, 62);
object ABC2 = rand.Next(1, 62);
object ABC3 = rand.Next(1, 62);
object ABC4 = rand.Next(1, 62);
object ABC5 = rand.Next(1, 62);
object ABC6 = rand.Next(1, 62);

string strABC1 = ABC.Substring(Convert.ToInt32(ABC1), 1);
string strABC2 = ABC.Substring(Convert.ToInt32(ABC2), 1);
string strABC3 = ABC.Substring(Convert.ToInt32(ABC3), 1);
string strABC4 = ABC.Substring(Convert.ToInt32(ABC4), 1);
string strABC5 = ABC.Substring(Convert.ToInt32(ABC5), 1);
string strABC6 = ABC.Substring(Convert.ToInt32(ABC6), 1);

string result = strABC1 + strABC2 + strABC3 + strABC4 + strABC5 + strABC6;


Session.Add("result", result);

Bitmap SecImage = new Bitmap(Server.MapPath("~/images/capcha-111.jpg"));
Graphics Grapimage = Graphics.FromImage(SecImage);
Grapimage.DrawString(result.ToString(), new Font("Tohoma",16, FontStyle.Strikeout), SystemBrushes.WindowText, new PointF());
SecImage.Save(Server.MapPath("~/images/security capcha-111.jpg")):عصبانی:;

Image1.ImageUrl = "~/images/security capcha-111.jpg";

از خط یکی مانده به آخر یعنی موقع save کردن ایراد میگیره؟

AmirRezanezhad
یک شنبه 20 بهمن 1392, 11:52 صبح
دوست گرامی لطفا کد ها رو تو تگ c# قرار بده .... خیلی بهم ریخته ست ...

malihe joon
یک شنبه 20 بهمن 1392, 21:44 عصر
string ABC = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890qwertyuiopasd fghjklzxcvbnm";

Random rand = new Random();

object ABC1 = rand.Next(1, 62);
object ABC2 = rand.Next(1, 62);
object ABC3 = rand.Next(1, 62);
object ABC4 = rand.Next(1, 62);
object ABC5 = rand.Next(1, 62);
object ABC6 = rand.Next(1, 62);

string strABC1 = ABC.Substring(Convert.ToInt32(ABC1), 1);
string strABC2 = ABC.Substring(Convert.ToInt32(ABC2), 1);
string strABC3 = ABC.Substring(Convert.ToInt32(ABC3), 1);
string strABC4 = ABC.Substring(Convert.ToInt32(ABC4), 1);
string strABC5 = ABC.Substring(Convert.ToInt32(ABC5), 1);
string strABC6 = ABC.Substring(Convert.ToInt32(ABC6), 1);

string result = strABC1 + strABC2 + strABC3 + strABC4 + strABC5 + strABC6;


Session.Add("result", result);

Bitmap SecImage = new Bitmap(Server.MapPath("~/images/capcha-111.jpg"));
Graphics Grapimage = Graphics.FromImage(SecImage);
Grapimage.DrawString(result.ToString(), new Font("Tohoma",16, FontStyle.Strikeout), SystemBrushes.WindowText, new PointF());
SecImage.Save(Server.MapPath("~/images/security capcha-111.jpg")):عصبانی:;

Image1.ImageUrl = "~/images/security capcha-111.jpg

kamranetemadi
دوشنبه 21 بهمن 1392, 00:42 صبح
خب بفرمایید چه خطایی تا ما هم در جریان باشیم!!!

malihe joon
دوشنبه 21 بهمن 1392, 11:15 صبح
تو آپلود کردن یک خط مانده به آخر خطا میگیره؟
SecImage.Save(Server.MapPath("~/images/security capcha-111.jpg"));

malihe joon
دوشنبه 21 بهمن 1392, 11:17 صبح
خطاش اینهA generic error occurred in GDI

malihe joon
دوشنبه 21 بهمن 1392, 11:18 صبح
A generic error occurred in GDI

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.

kamranetemadi
دوشنبه 21 بهمن 1392, 12:10 عصر
من که همین کد شما رو تست کردم مشکلی نداشت
فقط وقتی پوشه وجود نداشت همچین خطایی میداد و وقتی آدرس عکسی که باز شده با آدرس ذخیره یکسان بود