¾È³çÇϼ¼¿ä Ãʺ¸Ãʺ¸ °³¹ßÀÚÀÔ´Ï´Ù..
¿äÁò °Ô½ÃÆÇÀ» Á÷Á¢ ¸¸µå´Â ÁßÀε¥.. ±×Áß¿¡ ·Î±×ÀÎ °ü·Ã 󸮶§¹®¿¡ °í¿ªÀÌ³×¿ä ¤Ð
¼±ÀÓÀº ¹Ì¸® ¸¸µé¾î³õÀº ¼Ò½º ÀÖÀ¸´Ï±î ±×°Å ¾²¶ó°íÇϴµ¥ ÀÏ´Ü Á¦°¡ ¹¹¶óµµ ¾Ë°í ½á¾ßµÉ²¨°°¾Æ¼...
¶È°°ÀÌ µû¶óÇغôµ¥ Á¦°Å´Â ¾ÈµÇ³×¿ä ¤Ð¤Ð
¾Æ·¡ ¼Ò½º¿¡¼ FormsAuthentication.SetAuthCookie() ÇÏ¸é ·Î±×ÀÎ ÀÎÁõ µÇ´Â°Å¶û ¶È°°´Ù´Âµ¥...
Àú·¸°Ô ÇØµÎ°í³ª¸é
Request.IsAuthenticated·Î ·Î±×ÀÎ µÆ´ÂÁö ¾ÈµÆ´ÂÁö ¾Ë ¼ö ÀÖ´Ù°í ÇÏ´õ¶ó±¸¿ä..
msdn¿¡¼ ¹®¼µµ ã¾Æº¸°í.. Áö½ÄÀεµ ã¾Æº¸°í.. ±¸±Û¿¡ À¯Åõºê¿¡..
¹¹°¡ ¹ºÁöµµ ¸ð¸£°Ù°í ¶È°°ÀÌ ¾²´Â°Å °°Àºµ¥ ¿Ö ¾ÈµÇ´Â°ÇÁö ¸ð¸£°Ù½À´Ï´Ù;;
¿ø·¡ Àǵµ´ë·Î¶ó¸é ¸®ÅÏÀÌ '·Î±×ÀÎ µÆ³× µÆ¾î'¶ó´Â alertâÀÌ ¶°¾ßÇϴµ¥
·Î±×ÀÎÀÌ ¾ÈµÇ´Ï±î 'ÀÎÁõ ½ÇÆÐ'À̶ó´Â âÀÌ ¶ß³×¿ä ¤Ð
Ȥ½Ã ¹æ¹ý ¾Æ½Ã´ÂºÐ µµ¿ò ºÎŹµå¸³´Ï´Ù ¤Ð
public ActionResult Board_Login(User_Data ud) {
if (!ModelState.IsValid) { return Content("<script>alert('·Î±×ÀÎ ½ÇÆÐ'); window.close(); </script>"); } FormsAuthentication.SetAuthCookie(ud.user_name, false);
HttpCookie user_id = new HttpCookie("m_user_id"); user_id.Value = ud.user_name; user_id.Expires = DateTime.Now.AddDays(1d); Response.Cookies.Add(user_id);
if (Request.IsAuthenticated) { return Content("<script>alert('·Î±×ÀÎ µÆ³× µÆ¾î'); window.close(); </script>"); } return Content("<script>alert('ÀÎÁõ ½ÇÆÐ'); window.close(); </script>");
}
* ±×¸®±¸ ·Î±×ÀΠó¸®ÇÏ´Â ¹æ¹ýÀÌ ¶Ç ¿©·¯°³°¡ Àִٴµ¥... ¼¼¼ÇÀ̳ª ÄíÅ°·Îµµ ÇÏ´Â°Ô ¸Â´Â°Ç°¡¿ä??
µÑÀÇ °³³äÀ» Àß ¸ð¸£±ä ÇÏÁö¸¸... ¿ØÁö ÄíÅ°´Â ¾²¸é ¾ÈµÇ´Â°Ô ¾Æ´Ñ°¡ ½Í¾î¼¿ä ;;
¹Ì¸® µµ¿òÁֽŠºÐµé °¨»çµå¸³´Ï´Ù ¤Ð
|
SetAuthCookie ¸Þ¼µå¿¡¼
1. ƼÄÏ »ý¼ºÀ» À§ÇÑ Identity »ý¼º ¿©ºÎ
2. ÆûÀÎÁõ ƼÄÏ»ý¼º ¿©ºÎ (FormsAuthenticationTicket)
¸¦ È®ÀÎÇغ¸¼Å¾ß ÇÒµí