Solved

Quick Question. Urgent. Help with ASP email and session variables.

Posted on 2004-10-29
212 Views
Last Modified: 2006-11-17
I'd like to send and email contaiing all stored sessions using ASP.NET.

The variables will change on a regular basis, so it needs to be automated... just mail all stored variables.

Make sense?

       meMail.To = eAddress
        meMail.Bcc = eAddressBCC
        meMail.From = eAddressFrom
        meMail.BodyFormat = MailFormat.Html
        meMail.Subject = "Your quote from "
        meMail.Body = *** ALL MY SESSION VARIABLES IN HERE ***    
        SmtpMail.SmtpServer = "0.0.0.0"
        SmtpMail.Send(meMail)


Regards,
Craig
0
Question by:Choice-Quote
    11 Comments
     
    LVL 17

    Expert Comment

    by:AerosSaga
    are you storing your state in SQL server or using inproc?
    0
     
    LVL 18

    Expert Comment

    by:tusharashah
    For retrieving Session Values you can use something like following:

    Dim i As Integer = 0
    While i < Session.Count
     str1 += Session(i).ToString()
     i += 1
    End While

    -tushar
    0
     
    LVL 6

    Expert Comment

    by:ryerras
    If you are using InProc, you have to assign each session variable individually or concat them in a big string variable or array or whatevr you choose to. You can not email somethin like a session object
    0
     

    Author Comment

    by:Choice-Quote
    I'm storing them as session variables. not in sql.

    Tushar... how would I include this in the body of my email?

    Regards,
    Craig
    0
     
    LVL 18

    Expert Comment

    by:tusharashah
    Or this would be more accurate with Key names..
    Dim str1 As String = ""
    Dim i As Integer = 0
    While i < Session.Count
     str1 += Session.Keys(i).ToString() + ":" + Session(i).ToString()
     i += 1
    End While
    0
     
    LVL 18

    Accepted Solution

    by:

        Dim str1 As String = ""
    Dim i As Integer = 0
    While i < Session.Count
     str1 += Session.Keys(i).ToString() + ":" + Session(i).ToString()
     i += 1
    End While
       
        meMail.To = eAddress
            meMail.Bcc = eAddressBCC
            meMail.From = eAddressFrom
            meMail.BodyFormat = MailFormat.Html
            meMail.Subject = "Your quote from "
            meMail.Body = str1                                         'Just Assign your string here    
            SmtpMail.SmtpServer = "0.0.0.0"
            SmtpMail.Send(meMail)

    -tushar
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    very nice answer tusharashah;)

    0
     
    LVL 18

    Expert Comment

    by:tusharashah
    just learning from you Aeros..;)
    0
     

    Author Comment

    by:Choice-Quote
    Genius... I owe you a pint!

    0
     
    LVL 18

    Expert Comment

    by:tusharashah
    Allright...  have a ePint then..

    http://www.e-pint.com/epint.jpg

    -tushar
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    brilliant!
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Anonabox PRO Tor & VPN Router

    PRO is the most advanced way to fortify your privacy and online anonymity by layering the Tor network with VPN services. Use both together or separately, and without needing to download software onto your devices.

    Suggested Solutions

    Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    909 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now