Question Email Question

dfenton21

Member
Joined
Apr 26, 2011
Messages
20
Programming Experience
Beginner
I saw a nice bit of functionality in an application at work, and I would like to try to implement it in my own application that I am developing.

Basically, my application is used to manage training bookings. The user can select a CourseID and the click event of a command button will send an email. This email contains a HTML ASP.NET attachment. This webpage contains a list of all the people booked onto the course selected in the WinForms application.

I know how to send emails via VB.NET and I know how to create an ASP.NET webpage to display and modify data from a db, but I don't know how to:

(1) Send the ASP.NET page as an attachment from a WinForms application using VB.NET

(2) Use the CourseID that was selected in the WinForms application as the criteria for displaying information in the ASP.NET page that is attached to the email, i.e. the SQL code for the grid would be something like SELECT * FROM Bookings WHERE CourseID = SelectedCourseID. How do I specify that the SelectedCourseID is the CourseID selected in the WinForm application.

I'm not sure if this is even possible with VB / ASP.
I hope this is clear, and I'd very much appreicate your help.

P.S Sorry if I've posted this in the wrong forum. I'm unsure if the solution is coded in the WinForms application or the ASP.NET webpage (or a combination of the two)

Thanks in advance,

Damien
 
ASP.Net, or Active Server Pages, are pages that run at a web server, they can not run at an email receipent (a client). When ASP.Net pages are executed at the server by requests from browser clients the server returns the page as Html markup that is rendered by the client browser, an interactive page is also prepared for postback requests to the server.

The body of an email can be Html, or an Html attachment, the ASP.Net application can generate this Html content as any other text output. One simple approach is to generate the html string with for example a html table, HTML Tables. Outputting what would normally be a browser page as html may be possible, but not without troubles, see for example Emailing the Rendered Output of an ASP.NET Web Control in ASP.NET 2.0 - 4GuysFromRolla.com

Information can be sent from client to the server application with the querystring, that is as parameters to the request url. HttpRequest.QueryString Property (System.Web)
 
Back
Top