|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Beginner Problems
This question will probably be too simplistic for all of you, but I am trying to teach myself asp and I am having all sorts of problems. I have a simple html form which calls process.asp on submit: <html> <head></head> <body> <form action="process.asp" method=Post> <table cellpadding="0" cellspacing="5" align=center> <tr> <td width="100"><font color="#1B157F">Name:</font></font></td> <td><input type="text" name="txtName" size="55"></td> </tr> </table> <input type="submit" name="Submit" value="Submit Now"> </form> </body> </html> I want my process.asp page to display the name the user entered and then to send an email containing the information. Here is what I have so far for the process.asp page: <html> <head></head> <body> <% Dim strEmail Dim strName strName = Request.Form("txtName") Response.Write strName Set MyCDONTSMail = CreateObject("CDONTS.NewMail") MyCDONTSMail.From = "ema***@yahoo.com" MyCDONTSMail.To = "ema***@yahoo.com" MyCDONTSMail.Subject = "Get-A-Quote Request from " & strName MyCDONTSMail.Body = MyBody MyCDONTSMail.Send Set MyCDONTSMail = Nothing %> </body> </html> I am not trying to get this to run on a webserver at this point. I am just trying to get it run in a regular folder on my computer. I thought that might be the reason why I wasn't receiving any email but then the Response.Write doesn't work either. When I don't add the html tags I get a message that asks if I want to save or open the process.asp page instead of just running it. A little help? I'm obviously missing something . . . any advice would be greatly appreciated! Thank you! Joy Hi Joy,
No, you're off to a fine start (aside from the fact that you're using 1990s technology...). But ASP files MUST be processed by a Web server. You can probably run this locally on your machine. What are the answers to these questions: 1. What operating system are you running? 2. Do you have IIS installed, do you know? Ray at home <simchajoy2***@yahoo.com> wrote in message Show quote news:1136310232.068301.7140@g14g2000cwa.googlegroups.com... > I am not trying to get this to run on a webserver at this point. I am > just trying to get it run in a regular folder on my computer. I > thought that might be the reason why I wasn't receiving any email but > then the Response.Write doesn't work either. When I don't add the html > tags I get a message that asks if I want to save or open the > process.asp page instead of just running it. > > A little help? I'm obviously missing something . . . any advice would > be greatly appreciated! Thanks Ray,
I do have IIS installed and I am running Windows XP. However, the webpage will not reside on my computer however. What do I need to do? Joy The web page ~will~ not but currently does? That's fine. That's normal.
In a default IIS setup, your "home page" for your site should reside in C:\Inetpub\wwwroot. Put your ASP files there and test them by going to http://localhost/yourpagename.asp NOW, other things: CDONTS = CDO for NT Server. You're running Windows XP. It does not have CDONTS. If you installed the SMTP service when you installed IIS, you'll have CDOSYS. Read this: http://www.aspfaq.com/show.asp?id=2026 Depending on your setup where you're working, the e-mails may not actually be sent. Like, if you're a bank teller playing with ASP files in between customers and you start trying to relay e-mail from your site, it probably won't go. Instead, you may wind up getting a call from a network admin asking why your machine is trying to relay mail. I suggest that you just stop the SMTP service and test the success of your ASP code by verifying that the mail was placed in C:\Inetpub\mailroot\pickup, if it turns out that you cannot relay mail from your machine. Ray at home <simchajoy2***@yahoo.com> wrote in message Show quote news:1136319800.957068.123090@z14g2000cwz.googlegroups.com... > Thanks Ray, > > I do have IIS installed and I am running Windows XP. However, the > webpage will not reside on my computer however. What do I need to do? > > Joy > Thank you so much Ray, I have done as you instructed and I placed the
folder containing all my html and asp files in C:\Inetpub\wwwroot and then I created a virtual directory in IIS that points to that folder (I was supposed to do that right?) but when I say http://localhost/yourpagename.asp - it says the page cannot be displayed - do you have any idea what is wrong? Thanks! Joy Ok, silly me, I just needed to add the folder name to the path -
another question - I understand why the CDONTS doesn't work but Response.Write doesn't work at all either. Can you tell from my code if I am doing anything wrong? Thanks! Joy Show us your current code that you have now, and what does "doesn't work"
mean? Do you get an error? What does it say? Do you get a blank page? Also, did you read what I wrote about how CDONTS hasn't really been in vogue since 1999? Ray at home <simchajoy2***@yahoo.com> wrote in message Show quote news:1136394471.442043.321640@o13g2000cwo.googlegroups.com... > Ok, silly me, I just needed to add the folder name to the path - > another question - I understand why the CDONTS doesn't work but > Response.Write doesn't work at all either. Can you tell from my code > if I am doing anything wrong? > > Thanks! > > Joy > Hello simchajoy2***@yahoo.com,
About the CDOSYS as Ray Costanzo [MVP] said, he is correct, but in addition when you declare and set the variable, i noticed that you wrote Set MyCDONTSMail = CreateObject("CDONTS.NewMail") Its better to write Set MyCDONTSMail = Server.CreateObject("CDONTS.NewMail") I know that you might say that "what did u add the server, i doesn't make any difference" but trust me, when u program using Microsoft programs, everything is possible. For example once i was using MapPath("Location.mdb") and always getting an error, but couldn't find it, then i had an idea, which was to add server to the command, so it looked like this Server.MapPath("Locatuo.mdb"), after that the page worked propoply with no extra problem, and by the way when u click Ctrl+Space in Microsoft Visual InterDev you will find that MapPath works without the Server as well as the CreateObject. Hope this helps Best Regards Firas S Assaad firas***@gmail.com wrote:
> Hello simchajoy2***@yahoo.com, In older versions of IIS, this did make a difference. In newer versions, the > About the CDOSYS as Ray Costanzo [MVP] said, he is correct, but in > addition when you declare and set the variable, i noticed that you > wrote Set MyCDONTSMail = CreateObject("CDONTS.NewMail") > Its better to write Set MyCDONTSMail = > Server.CreateObject("CDONTS.NewMail") recommendation is to use the vbscript version of CreateObject, rather than the version provided by the Server object. For more information, see: http://blogs.msdn.com/ericlippert/archive/2004/06/01/145686.aspx -- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM" Bob Barrows [MVP] wrote:
> In older versions of IIS, this did make a difference. In newer How on Earth do you get any recommendation out of Lippert's article?> versions, the recommendation is to use the vbscript version of > CreateObject, rather than the version provided by the Server object. > For more information, see: > http://blogs.msdn.com/ericlippert/archive/2004/06/01/145686.aspx On the contrary, one of the comments suggests that this approach voids connection pooling, and that would certainly give me pause. -- Dave Anderson Unsolicited commercial email will be read at a cost of $500 per message. Use of this email address implies consent to these terms. Please do not contact me directly or ask me to contact you directly for assistance. If your question is worth asking, it's worth posting. Dave Anderson wrote:
> Bob Barrows [MVP] wrote: Yes, you're right. My bad. Eric made no recommendations. I had a>> In older versions of IIS, this did make a difference. In newer >> versions, the recommendation is to use the vbscript version of >> CreateObject, rather than the version provided by the Server object. >> For more information, see: >> http://blogs.msdn.com/ericlippert/archive/2004/06/01/145686.aspx > > How on Earth do you get any recommendation out of Lippert's article? recommendation made in a post by Egbert Nierop (http://groups.google.com/group/microsoft.public.inetserver.asp.general/msg/ 409380a9492fb9c8?hl=en&) in the back of my mind when I wrote the above. He had done some testing and come to the conclusion that using the Server version was not only unnecessary in IIS5+, but that it also impaired performance. Here's a another quote: WEll, quite simple. IIS 3/4 supported transaction management COM integration using Server.Createobject. This statement, passes the COM context from ASP to the inner component. As of Windows 2000, this is no longer needed because of native COM support for transactions and context passing, and it even slows down execution. On windows 2000, it will process exception on components, that have no thread affinity (C++). > Yes, me too. But this was not stated by Eric, and was not substantiated by> On the contrary, one of the comments suggests that this approach voids > connection pooling, and that would certainly give me pause. > the person who brought it up. Bob Barrows -- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup. Bob Barrows [MVP] wrote:
> I had a recommendation made in a post by Egbert Nierop ( Fair enough.> http://groups.google.com/group/microsoft.public.inetserver.asp.general/msg/409380a9492fb9c8?hl=en > &) in the back of my mind when I wrote the above. > He had done some testing and come to the conclusion that When I read his post, I had a reaction similar to yours below.> using the Server version was not only unnecessary in IIS5+, > but that it also impaired performance. >> On the contrary, one of the comments suggests that this Like you, I would have liked something concrete. And that is why I merely >> approach voids connection pooling, and that would certainly >> give me pause. > > Yes, me too. But this was not stated by Eric, and was not > substantiated by the person who brought it up. said it would give me pause. In truth, I do not feel that EITHER assertion was backed up with substance, so neither would be likely to change my practices. If I thought I had a limitless number of ASP-coding days ahead of me, I might spend some time exploring the issues in order to convince myself one way or the other. But let's face it -- most of us will be doing less and less with ASP in the future, so why waste the time looking for a cycle here and there? It's not as if anyone suggested that either approach would cause some type of cascading performance issue... -- Dave Anderson Unsolicited commercial email will be read at a cost of $500 per message. Use of this email address implies consent to these terms. Please do not contact me directly or ask me to contact you directly for assistance. If your question is worth asking, it's worth posting. Dave Anderson wrote:
Show quote > Bob Barrows [MVP] wrote: I suspected that would be your response, and after posting the above, tried >> I had a recommendation made in a post by Egbert Nierop ( >> http://groups.google.com/group/microsoft.public.inetserver.asp.general/msg/409380a9492fb9c8?hl=en >> &) in the back of my mind when I wrote the above. > > Fair enough. > > > >> He had done some testing and come to the conclusion that >> using the Server version was not only unnecessary in IIS5+, >> but that it also impaired performance. > > When I read his post, I had a reaction similar to yours below. > to find the post that really convinced me, but could not find it, so as you say later on in your reply, it's time to move on. -- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM" simchajoy2***@yahoo.com wrote:
> Thank you so much Ray, I have done as you instructed and I placed the If you're using IE, make sure in Internet Options that "Show Friendly> folder containing all my html and asp files in C:\Inetpub\wwwroot and > then I created a virtual directory in IIS that points to that folder (I > was supposed to do that right?) but when I say > http://localhost/yourpagename.asp - it says the page cannot be > displayed - do you have any idea what is wrong? HTTP error messages" is turned OFF. This way the browser will tell you exactly where the error is occurring in the ASP. There could be a syntax error on line 1, and you'd never know it. simchajoy2***@yahoo.com wrote:
> Thank you so much Ray, I have done as you instructed and I placed the Just a thought.... but are you actually typing> folder containing all my html and asp files in C:\Inetpub\wwwroot and > then I created a virtual directory in IIS that points to that folder (I > was supposed to do that right?) but when I say > http://localhost/yourpagename.asp - it says the page cannot be > displayed - do you have any idea what is wrong? > > Thanks! > > Joy "http://localhost/yourpagename.asp" into the address bar of the browser? If so, you should replace "yourpagename.asp" with the name of the directory you created, then "/" then the name of the html file you created (with ".html" on the end). /P. |
|||||||||||||||||||||||