I face a problem for ASP Login Script. There are two pages index.asp and login.asp, but after login I do not see the LOGOUT text, I see LOGIN again. So can you please tell me , where have I done mistake? Index.asp Codes: <html> <head> <title>¿¡ÇõðÀÌ(FDE)</title> </head> <body bgcolor="black" text="black" link="#000066" vlink="#000066" alink="#660033"> <table border="0" width="977" align="center" bgcolor="#CCCCCC"> <tr> <td width="967" colspan="2" height="34"> <p> <b><font color="#330066">Welcome to FDE world! This is all yours.</font></b></p> </td> </tr> <tr> <td width="804" height="100"> <p align="center"><object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="804" height="100"> <param name="movie" value="menu bar.swf"> <param name="play" value="true"> <param name="loop" value="true"> <param name="quality" value="high"> <embed width="804" height="100" src="menu bar.swf" play="true" loop="true" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object></p> </td> <td width="212" height="119"> <p align="right"> <% if session("id")="" then %> <a href="join.asp">Join</a> <a href="login.asp">Login</a> <% else %> <%=Session("id")%> <a href="logout.asp">Logout</a><% End If %> </p> </td> </tr> <tr> <td width="800" height="600"> <table width=800 border="0" cellspacing="0" cellpadding="0" height=600> <tr> <td width=800 height="600"> <iframe src="Introduction.asp" height="600" scrolling=auto frameborder=0 name=main width="800" height="600" align=center leftmargin="0" topmargin="0" marginheight="0" marginwidth="0"></iframe> </td> </tr> </table> </td> <td width="212" height="600"> <P style="line-height:130%; margin-top:0; margin-bottom:0;"> </p> </td> </tr> <tr> <td width="1012" height="25" colspan="2"> <p style="margin-top:0;"> <a href="education.asp" target="main">Education</a> <a href="Branch Office.asp" target="main">Branch Off</a> <a href="partnership.asp" target="main">Partnership Relation Ship</a> <a href="trade Section.asp" target="main">Trade Section</a><a href="introduction.asp" target="main"></a></p> </td> </tr> <tr> <td width="1012" colspan="2" height="66"> <p style="line-height:130%; margin-top:0; margin-bottom:0;"><font size="1"> Address : <span style="line-height:130%; margin-top:0; margin-bottom:0;">Chiram-dong ,Jinju-si, Gyeongsangnam-do, Korea </span>506-46 Business Number : 613-81-41198</font></p> <P style="line-height:130%; margin-top:0; margin-bottom:0;"> <font size="1"> Tel : 82-55-761-1243 <a href="mailto:fde@hushmail.com">fde@hushmail.com</a> Chaire man's E-mail : ruku@hanmir.com</font></p> <p style="line-height:130%; margin-top:0; margin-bottom:0;"> <font size="1">Manager : Kim Sung Dong ( Mike Kim )</font></p> </td> </tr> </table> </body> </html> login.asp Codes: <!--#include file="xt_login.asp"--> <HTML> <HEAD> <TITLE>로그인</TITLE> </HEAD> <BODY> <% If cnt > 0 Then Response.write "다음 사항을 다시 확인하고 로그인 하세요<br>" For i = 1 To cnt %> <font size="2" color="red"><%=msg(i)%></font><br> <% Next End if %> <form method="post" action="index.asp"> <input type="hidden" name="validate" value="1"> <table> <tr> <td>id : </td><td><input type="text" name="id"> </td> </tr> <tr> <td>pw : </td><td><input type="text" name="pw"></td> </tr> <tr> <td> </td><td><input type="submit" value="로그인"></td> </tr> </table> </form> </BODY> </html> please send me , where is the problem that I do not see the LogOut after LogIn. Thanks Meao007
Not sure how it works with ASP, but I know in coldfusion the logout feature does not automatically appear jsut because you're logged in. I make a link similar to: index.cfm?logout=yes then use a cfif to check for yes <cfif IsDefined("URL.logout")> <cfif URL.logout EQ yes> <cflogout> </cfif> </cfif> something like that... I'm sure ASP is similar - you manually have to insert the code for the 'logout' feature.
it doesnt look like you set the session variable with the id so it always holds true that session("id") is "" which displays the login. The way it looks as you have the form on login.asp and index.asp just requests the id passed from the form. If thats the case you should check the request. So: <p align="right"> <% if request("id")="" then %> <a href="join.asp">Join</a> <a href="login.asp">Login</a> <% else %> <%=Request("id")%> <a href="logout.asp">Logout</a><% End If %> </p> Code (markup): this to me is not right way to code it either though. To set a session variable in ASP you do something like: <% Session("username")="Donald Duck" Session("age")=50 %> Welcome <%Response.Write(Session("username"))%> as you see you have to say Session("id") = something which you never do and thats why it is "" always. So the form should maybe go back to login.asp and say: Session("id") = Request("id") Response.Redirect index.asp Then when it gets to index.asp session("id") should have the proper value PM me or write back if you need more details