Forum Moderators: open

Message Too Old, No Replies

Saving ASP output to send as an email

         

ayeen

2:22 am on Jan 25, 2005 (gmt 0)

10+ Year Member



hello there guys! just want to ask for your help. im having trouble on how to save the output code of my asp page. the scenario is a have a universal asp page that accepts parameter (id) and display information based on the given id. what i need to do it save the output of that asp per given id. hope to hear from you :)

webboy1

9:38 pm on Jan 25, 2005 (gmt 0)

10+ Year Member



It depends largely on what you mean by "saving" the information.

Not knowing exactly what you mean, i will assume that you intend using this info throughout your site? So when someone logs in, you pull their name, and use it through out the site for that personal touch?

It is quite simple. You can do this by using cookies or sessions. Once you have pulled out all the users info from the database, created some sessions for there first name, surname etc etc.

Then on each page, you simply need to pull the relevant session.

There are probably a lot more secure / complicated ways to do this, but this is how we do it and it seems to work fine for what we need.

Hope this helps!

P.s. Let me know if this is not what you meant and i will try again!

ayeen

11:32 pm on Jan 25, 2005 (gmt 0)

10+ Year Member



thanks for the reply webboy1!

what i mean by saving the asp output is saving the "generated source code" of a particular asp page that accepts paramater and generates different information based on that data.

The situation is like this, i have an asp page that accepts customer id in order to display the appropriate details of that customer. What i need to do is save the generated code of that asp into an html page and send it to the customer via email. In this way the customer can easily view their information thru the generate html page attached on the email and not the asp page that will take some time to retrieve their information. Hope you can help me on this... thanks in advance!

webboy1

9:12 am on Jan 26, 2005 (gmt 0)

10+ Year Member



Morning,

Cool .... now i understand! I'm not sure if i can give you a completely secure way of doing this .... but I do have a solution.

I don't know how to save the entire source to be sent out via email, but i do know how you can save the vital information i.e. customer details and send that out in an email.

Instead of creating sessions or cookies with the data, create variables. Then, use an ASP email script and insert the relevant variables into it. I use this method quite a lot for sending out passwords, usernames, member newsletters etc.

Again, not sure how to send the full source code, but you could create your own default email template (which could look similar to your web page) and use the method above to insert the correct user details into it.

Hope this helps.

ayeen

11:51 pm on Jan 26, 2005 (gmt 0)

10+ Year Member



Again thanks for the reply webboy1!

I do appreciate your help and it sure did help tho' im still searching for a way to save the entire code.

TheNige

8:09 pm on Jan 27, 2005 (gmt 0)

10+ Year Member



In ASP, you do not need to put any regular HTML code on the page. You can use the Response.Write method to write the HTML you want to the page from the script....and in your case...create a string of all the HTML and then either email it or send it to the page.

Dim strHTML
Dim strVariable

strVariable = GetUserDetails(UserID)

strHTML = "<HTML><BODY>My text Goes here: " & strVariable & "</BODY></HTML>

You could break this up into many lines with concantenation...

strHTML = "<HTML>"
strHTML = strHTML & "</HTML>"

Now that you have your entire page in a string you can send it to the page....

Response.Write(strHTML)

or even send it away in an email as the body...after you set the email format to HTML.

hope that helps you.

ayeen

11:35 pm on Jan 27, 2005 (gmt 0)

10+ Year Member



Thanks TheNige!

I really appreciate your help :)