Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

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

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
Choice-Quote
Asked:
Choice-Quote
  • 5
  • 3
  • 2
  • +1
1 Solution
 
AerosSagaCommented:
are you storing your state in SQL server or using inproc?
0
 
tusharashahCommented:
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
 
ryerrasCommented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Choice-QuoteAuthor Commented:
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
 
tusharashahCommented:
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
 
tusharashahCommented:

    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
 
AerosSagaCommented:
very nice answer tusharashah;)

0
 
tusharashahCommented:
just learning from you Aeros..;)
0
 
Choice-QuoteAuthor Commented:
Genius... I owe you a pint!

0
 
tusharashahCommented:
Allright...  have a ePint then..

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

-tushar
0
 
AerosSagaCommented:
brilliant!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now