Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 8th, 2009, 12:06 PM
Friend of Wrox
Points: 489, Level: 7
Points: 489, Level: 7 Points: 489, Level: 7 Points: 489, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2006
Location: Berkshire, United Kingdom.
Posts: 104
Thanks: 9
Thanked 1 Time in 1 Post
Default Static URL using CreateMHTMLBody

Chaps,

I have been using CDO.Message for a little while and once you add a few additional schemas it becomes a very useful tool.

The annoying issue i am having is with CreateMHTMLBody.

I am using an asp template page to produce the HTML mail body which again works well.

The issue is with the URL used to locate the template page. At present i can not find a way of locating the page without the full Static url location, eg:

Below with full URL

Code:
objMessage.CreateMHTMLBody("http://somewebsite/mail.asp"& _
       "?Un=" & UserName & ""& _
       "&Um=" & UserEmail & "")


Below with non static URL - Errors

Code:
objMessage.CreateMHTMLBody("../mail.asp"& _
       "?Un=" & UserName & ""& _
       "&Um=" & UserEmail & "")



Is there is way of linking to the template page without using the full URL?

Any suggestions would be great.


Cheers

Aspless

Reply With Quote
  #2 (permalink)  
Old January 8th, 2009, 06:29 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

IME with CreateMHTMLBody you can not use a relative path.

It intrigues me why you would spend time trying to get a relative path working in this scenario. Any particular reason?
__________________
Wind is your friend
Matt
Reply With Quote
The Following User Says Thank You to mat41 For This Useful Post:
aspless (January 8th, 2009)
  #3 (permalink)  
Old January 8th, 2009, 06:41 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

You *could* create the absolute path, yourself, with only a bit of code.
Code:
server = Request.ServerVariables("SERVER_NAME")
curpage = Request.ServerVariables("URL")
curdir = Left( curpage, InStrRev(curpage,"/")-1 ) ' strip off file name
uponeDir = Left( curdir, InStrRev(curpage,"/")-1 ) ' same as ".."
absURL = "http://" & server & uponeDir & "/mail.asp"
objMessage.CreateMHTMLBody(absURL & "?Un=" & UserName & "&Um=" & UserEmail & "")
p.s.: That code *ASSUMES* that you are in a subdir and so you *CAN* do the "..". If you may or may not be in a subdir, you'd need to test for that second / [the first one will always be there].
Reply With Quote
The Following User Says Thank You to Old Pedant For This Useful Post:
aspless (January 8th, 2009)
  #4 (permalink)  
Old January 8th, 2009, 07:14 PM
Friend of Wrox
Points: 489, Level: 7
Points: 489, Level: 7 Points: 489, Level: 7 Points: 489, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2006
Location: Berkshire, United Kingdom.
Posts: 104
Thanks: 9
Thanked 1 Time in 1 Post
Default

The reason is a fairly simple one.

I use VMware for my development/IIS platform which runs all contained within the dev laptop i use.

For testing locally pre upload to live site, i use one objMessage.CreateMHTMLBody location for the VM server address and then need to change the address pre upload to the live server and test.

So far i have succeeded in not having any static links in the site with exception of the above.

Due to being able to include urn:schemas allows me to set priorities, Follow up flags and reply-by date/times, which makes useful admin notification emails for forgot password, call back and other notification emails.

So i intend on creating allot of static templates for each notification type - eg lot's of nice static url's to change.

It is more an administrational faf than an issue.

I can probably get around the issue by including an SQL reference which removes the need to use asp to any great length.

Is there any server variables that retrieve the full page URL? just a dim lit thought?

Addition to post - Thanks Old Pedant I'll have a look and try

Cheers


Aspless

Last edited by aspless; January 8th, 2009 at 07:18 PM..
Reply With Quote
  #5 (permalink)  
Old January 8th, 2009, 07:39 PM
Friend of Wrox
Points: 489, Level: 7
Points: 489, Level: 7 Points: 489, Level: 7 Points: 489, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2006
Location: Berkshire, United Kingdom.
Posts: 104
Thanks: 9
Thanked 1 Time in 1 Post
Default

Thanks guys.

That worked a treat.

Also adding InStrRev to my next google search.

Always good to learn new Instr functions.

Cheers


Aspless
Reply With Quote
  #6 (permalink)  
Old January 8th, 2009, 07:43 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;For testing locally pre upload to live site, i use one objMessage.CreateMHTMLBody location for the VM server address and then need to change the address pre upload to the live server and test

Do you not use a global file for constants/variables etc? I use one for everything that changes from environment to environment, of course this eliminates the need to make alterations page to page. EG here are a couple of very useful ones:

inside global.asp:

Const URLBase = "http://someName.com/"
Const mailIP = "192.168.20.10"

now on all your pages your URL is of course:

URLBase


Doesnt HTTP_HOST get the full URL?
__________________
Wind is your friend
Matt
Reply With Quote
The Following User Says Thank You to mat41 For This Useful Post:
aspless (January 8th, 2009)
  #7 (permalink)  
Old January 8th, 2009, 08:01 PM
Friend of Wrox
Points: 489, Level: 7
Points: 489, Level: 7 Points: 489, Level: 7 Points: 489, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2006
Location: Berkshire, United Kingdom.
Posts: 104
Thanks: 9
Thanked 1 Time in 1 Post
Default

Honest answer is no.

I have not had as yet a need to specify global variables.

Thankfully i have not needed to include server specific configuarations to cdo mail so until now it was not a consideration.

I can see and have read before about good practise use of global variables.

Thanks for the reminder.


Cheers

Aspless
Reply With Quote
  #8 (permalink)  
Old January 9th, 2009, 01:28 AM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Mat41: No, HTTP_HOST gives the same value as SERVER_NAME, except in some weird instances.

AspLess: No, there is no such server variable. Here's a dump of all the servervariables on one of my sites:
http://www.juncojunction.com/framitz.asp

AspLess: Oh, PLEASE! DO NOT USE GOOGLE to find keywords and such for a *LANGUAGE*! Use the REAL THING! The VBScript documentation! MUCH MUCH more compact! You can see it online, here:
http://msdn.microsoft.com/en-us/library/ms950396.aspx
Click on VBScript under "References".

Or, even better, download the full docs here:
http://www.microsoft.com/downloads/d...displaylang=en

The help file gives you a full index and search capabilities, all on your own machined. MUCH better than hassling with Google and HOPING you only have to look at 4 or 5 pages before you find the one that has what you need.
Reply With Quote
The Following User Says Thank You to Old Pedant For This Useful Post:
aspless (January 15th, 2009)
  #9 (permalink)  
Old January 15th, 2009, 01:40 PM
Friend of Wrox
Points: 489, Level: 7
Points: 489, Level: 7 Points: 489, Level: 7 Points: 489, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2006
Location: Berkshire, United Kingdom.
Posts: 104
Thanks: 9
Thanked 1 Time in 1 Post
Default

Old Pedant,

Thanks for the VBScript reference links.

Much quicker..

Cheers

Aspless
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
non-static reports to static html files miamikk ASP.NET 2.0 Basics 0 June 4th, 2007 01:48 PM
CreateMHTMLBody issues aspless Classic ASP Basics 3 January 8th, 2007 08:26 PM
CHR(13) errors in CDO.CreateMHTMLBody() janaka44 Classic ASP Professional 0 April 5th, 2006 11:08 PM
extract URL from Favorites (.URL Files) PhilHawks VB.NET 2002/2003 Basics 2 November 2nd, 2004 04:35 AM



All times are GMT -4. The time now is 05:47 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.