Click to See Complete Forum and Search --> : asp.net included into old asp
thechasboi
01-16-2007, 03:03 PM
I have this application that allows the user to choose which images they want to request info on. Currently I am using a legacy asp form that is tied into a .net mail script. It does not always work reliably. It is a pain and constant changing and fixing is not good for productivity. I want to switch this asp page to a .net page and have code behind to send the email. But the conundrum I am having is that the old asp page is one long string for the form as a response.write. Will this work with the asp.net page. If so then I am set I just reprogram the page to be .net and code behind instead of include and calling an asp page with a calling of the mail script. Too many different page changes for my comfort. I would appreciate some ideas. Thanks for the reply.
CarolineBogart
01-17-2007, 07:22 AM
Sort of but not really. For one, a .net page can have only one form. For two, it must runat="server" - so it's not straightforward.
thechasboi
01-17-2007, 11:15 AM
CarolineBogart
The legacy asp page is an include. I had to change it to response.write the html to the table it is in so it actually showed up in the table. I am wondering if I can do something similar if I take the legacy asp page and turn it into a straight .net page so I can include the emailing script in that page as a runat server instead of having to call another page and pray that it works every time. The last thing i need to make sure i say correctly is that I need this asp.net page to be called by the legacy asp page to response.write the text to the table. The way the legacy system is programmed is that when you click a hyperlink the page physically refreshes with the for appearing in the table instead of other element that was there before. I have no clue in making the ald asp page work entirely correctly with the email script so I would love to see if i can save some time and make it into an asp.net page. If not I can post both the form and include file for looking at. Thanks so much for the post.
CarolineBogart
01-17-2007, 05:28 PM
OK not sure why calling another page is a risk, what is risky there? If you're asking, can you include an asp page in an asp.net page? No. Sounds like you want to write a new asp.net page that draws a runat = server form and uses System.Mail. Which is a good direction to go. Though if you are calling an asp page from asp.net the only real concern is they don't share session state, so the parameters have to be coded in a way that the receiving function can find them. Too much work. In the .net page create an input form and send it using System.Mail, then get rid of the asp page altogether.
thechasboi
01-18-2007, 12:15 PM
CarolineBogart
Thanks for the replies. I actually have to go the other way with this asp.net page. I need IT to be included in an asp page. I need the html to be response.write to the screen inside this table after some one clicks on a link button. Thanks for the reply
CarolineBogart
01-18-2007, 12:45 PM
CarolineBogart
Thanks for the replies. I actually have to go the other way with this asp.net page. I need IT to be included in an asp page. I need the html to be response.write to the screen inside this table after some one clicks on a link button. Thanks for the reply
Oh that is not possible. .net web apps require the JIT compiler which classic ASP won't invoke.
thechasboi
01-18-2007, 05:47 PM
OK Thanks for the help. I was hoping that it was the other way. Thanks again. I know I am going to need help in getting data from the asp form. I was wondering if you could give me some suggestions. I would love to get it in an array format in one fail swoop.
CarolineBogart
01-18-2007, 10:31 PM
Could you be very specific about what you want to do and on which platform?
thechasboi
01-19-2007, 11:18 AM
I have this request form with 8 different fields in an asp page. I need to get all the form data from these fields and send them to the .net mail script. Or I need to get the form data using the .net mail script. I am pretty sure I need to use the mail form yo get the data because one of the elements is a text box. I have a cookie variable I am going to get to also include. I was also wondering if it is possible to make this flexible enough to have different names and numbers of fields in the form. Thanks for the reply. I have loads of javascript experience and a pretty good asp experience but my .net is sorta sketchy. I totally appreciate the help and hints.
CarolineBogart
01-19-2007, 11:28 PM
Well the cookie is iffy 'cause asp and asp.net don't share session state. Can you just build an asp.net form with the 8 fields?
thechasboi
01-22-2007, 09:58 AM
I can not build another form in asp.net cause the asp.net form will not be outputted by the asp page. This is part of the question you answered where you mentioned that it is not possible to have the asp page call an asp.net page cause of the JIT compiler. I need a reliable easy way to get data from the asp page after the form calls the asp.net mail script. I am attempting this as we speak. I am including a code snippet. Thanks for the replies.
Dim idString As String = HttpContext.Current.Request.QueryString.Item("Pics")
Me.idArray = idString.Split(",")
SendMessages(Me.idArray)
Private Sub SendMessages(ByVal ea As Array)
Try
For Each Item As String In ea
pics is the name of the form. I think this will work. I have one question, Is this robust enough to allow for different questions on the form? Can I tell what the question is by using code that gets the data like this? Thanks for the reply.
CarolineBogart
01-22-2007, 10:09 AM
Let's backup a second.
What do you mean the mail doesn't always work reliably?
You stated that the legacy app is tied to a .net mail script. You want to change the form to a .net app. So that would eliminate the legacy app. You would have a .net form sending info to a .net mail method. There's no conflict, you've rid the server of the legacy part.
thechasboi
01-22-2007, 10:43 AM
CarolineBogart
Tha is all and well to get rid of the form and make it .net from the start. But the problem is that the entire page that includes the form is a legacy asp page that has include files, which those include have includes themselves. It is an intertwined complex mess that works OK at the moment. It would take many many weeks if not more to decifer the includes and all other asp pages used to makes this form a .net form cause everything else would need to be .net. OK i hope that made sense. The way the current page works is that after some one looks at some pictures and decides whether to request one or not they select by checking a check box. Once picture/s are selected they can hit the "submit Request" button which reloads the page to change the area that contained the picture info to have the form instead. Once the form is filled out the user clicks the "Submit Request" button and the form calls this .net mail script to send the email. The problem I am having is that the form data is there but the .net page called is not getting the data correctly all the time. Why, I am not entirely sure. I spent way too much time trying to figure this out. I need to redesign it so I can have multiple forms that have different questions so I would only have one script. But my limited knowledge of .net and its possibilities is limiting my programming this thing in many ways. I really need a way to get form data and its corresponding name so that the meail script can do its job for different forms which will have different questions. I hope this makes sense.
Thanks again for all the replies.
CarolineBogart
01-22-2007, 10:56 AM
How are you currently sending the data from the asp form to the .net mail?
thechasboi
01-22-2007, 12:17 PM
The code is a total mess for the email scripts. I would appreciate some pointer in starting over. The email script is confusing and has no real structure besides the attempt in creation of a class. The for is ok, I am not married to it so that can changed for cleaning up the code. I am including the form code if that helps. Thanks for the help again. Sorry for the mess, I was trying to avoid this but if it will help, thanks again.
CarolineBogart
01-22-2007, 01:45 PM
OK let me get it straight.
You have an asp form, an asp.net email class.
You want to get rid of the asp.net email class. So why aren't you sending your email in asp instead?
thechasboi
01-22-2007, 03:40 PM
CarolineBogart
The .net page is doing things that an ordinary asp page can not. So a .net email script is needed. Thanks for the reply. All I need is to get the form data from the old asp form in a quick and concise manner. I need all the names and their values to be sent to the asp page. I can use the url but not sure how long the url can actually be. I have read the max length but do not really remember and besides using the url is highly suspect to some one playing funny with the data. Thanks for the reply.
CarolineBogart
01-22-2007, 04:19 PM
OK Sorry it took me so long to follow. If you don't want to use the (URL max length 255) you can post using xmlhttp
http://support.microsoft.com/kb/290591
client.asp
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function XMLHTTPButton_onclick() {
var DataToSend = "id=1&recipient=caroline@bogartcomputing.com";
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("POST","http://YOURSERVER/receiver.asp",false);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send(DataToSend);
alert(xmlhttp.responseXML.xml);
}
//-->
</SCRIPT>
<INPUT type="button" value="Submit XMLHTTP" id=XMLHTTPButton name=XMLHTTPButton
LANGUAGE=javascript onclick="return XMLHTTPButton_onclick()">
receiver.asp
<%@language=vbscript%>
<%
recipient = Request.Form("recipient")
from= Request.Form("from")
subject=request.Form("subject")
body=request.Form("body")
Response.ContentType = "text/xml"
response.write "<Recipient>" & recipient & "</Recipient>"
' response.write "<ReturnValue>" & value & "</ReturnValue>"
%>
thechasboi
01-23-2007, 09:25 AM
CarolineBogart
Thanks for the reply. I will take your XML suggestion and look into a server side way of transferring the data to the email script via XML. Thanks for all the help and posts. I really appreciate it. If ever you need help with javascript or other languages feel free to send your questions. charley.george@gmail.com. Thanks again much appreciated.
CarolineBogart
01-23-2007, 02:28 PM
Hey you're welcome.