Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: the code in the asp 3.0 for professional page 886 something is wrong


Message #1 by "shyamala" <shyamyn@h...> on Wed, 7 Nov 2001 11:13:34
this is a piece of code that i have tried in the wrox book

but there was an error in line 36

that is 



Set objInbox=objCurSession.Inbox

below is my code 

i really don`t know what is wrong 

i`ve been trying for a week already

somebody please help before i go mad

------------------------------------------------------------------------

<%@ Language=VBScript %>

<% Option Explicit  %>

<HTML>

<HEAD>

<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">

<TITLE><%=Request.QueryString("UserName")%>`s Inbox</TITLE>

</HEAD>

<BODY>

<%

 dim objInbox

 dim colMsgs

 dim strUserName

 dim strUserEMail

 dim objCurSession

 

 

 'Assign the Values from the query string into local variables

 'since they will be needed more than once.

strUserName=Request.QueryString("UserName")

strUserEMail=Request.QueryString("UserEMail")



 'Store the session object,user name,and e-mail

 'in asp session variables for possible future use.

 Session("UserName")=strUserName

 Session("UserEMail")=strUserEMail



 'use the values passed in to create a new session and 

 'initialize its variable

 set objCurSession=Createobject("CDONTS.Session")

 objCurSession.LogonSMTP strUserName,strUserEMail

 

 'create a session variable to hold the user`s CDONTS sessions object 

 set Session("CurSession")=objCurSession



 'Get the inbox folder object

 set objInbox = objCurSession.Inbox

 

 'Using that object,get the collection of messages in the inbox

 set colMsgs = objInbox.Messages



  'Display greeting to user

  

  Response.Write "Welcome,"&Session("UserName")&_

                 ".You Have "&colMsgs.Count&" messages in your 

inbox.<BR></BR>"

 'Then,display a listing of the messages in their inbox 

 'Only display the table if there are some messages to display

 

  if(colMsgs.Count >0) then

   %>

   <TABLE BORDER=0 CELLPADING=1 CELLSPACING=1 WIDTH=90% >

   <TR>

   <TD><STRONG>Importance</STRONG></TD>

   <TD><STRONG>From</STRONG></TD>

   <TD><STRONG>Subject</STRONG></TD>

   <TD><STRONG>Sent</STRONG></TD>

   </TR>

   <%

     dim intLoop

     for intLoop=1 to colMsgs.Count

   %>

   <TR>

   <TD ALIGN = MIDDLE>

   <%ShowImportanceIcon(colMsgs(intLoop).Importance)%></TD>

   <TD><%=colMsgs(intLoop).Sender%></TD>

   <TD><A HREF="ViewMessage.asp?MsgID=<%=intLoop%>">

       <%=colMsgs(intLoop).Subject%></A></TD>

   <TD><%=colMsgs(intLoop).TimeSent%></TD>

   </TR>

   <%

     Next

   End If

   %>

   </TABLE>

   </BODY>

   </HTML>

   <%

     'Function to generate the correct IMG tag for the appropriate icon

     sub ShowImportance(intImpValue)

      dim strIconFile

      

      Select Case intImpValue

       Case CdoNormal

        strIconFile="Norm_Importance.gif"

       Case CdoHigh

        strIconFile="High_Importance.gif"

       Case CdoLow

        strIconFile="Low_Importance.gif"

      End Select

      Response.Write("<IMG ="&strIconFile&">")

    End sub

  %>

       

     



<P>&nbsp;</P>



</BODY>

</HTML>


  Return to Index