Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: Web Connect and ASP

$
0
0
Re: Web Connect and ASP
Web Connection
Re: Web Connect and ASP
04/13/2012
01:05:07 PM
3H81FFR9C Show this entire thread in new window
Gratar Image based on email address
From:
Stein Goering
To:
All 
Attachments:
None


Since search engines already have our pages indexed with the .htm extension, is there any way to script map the .htm extension so that any html page would still be found by the search engines, but any scripts inside them would be processed? I don't want to have to edit all the other html pages we have; just have a few that need the scripts to process when served.


Alternatively, you could set up dummy .htm pages that correspond to your script pages and use Meta refresh tags to redirect. e.g. if you had a page called Mypage.htm that you now want to replace with a script mapped page, go ahead and create a Mypage method that will be invoked by calling Mypage.avt - but keep a stub copy of Mypage.htm with this code in the header:
<META HTTP-EQUIV="Refresh" CONTENT="1; URL=Mypage.avt">

--stein


THere shouldn't be any problems with that as long as you don't use a media type extension that is commonly used and identified for non-text data (it wouldn't be a good idea to use .jpg for example :-)).

FWIW, you can also chose to script map another extension like .php or .asp .cf (cold fusion) if you don't use those althogh in general I don't think that's the best idea as it may bite you in the future if you do add asp or php or whatever content.

+++ Rick ---



Got it working correctly. Thanks.

One other question: Will using files with these script map extensions (.avt in our case) have any negative impact on the way search engines view our pages (other than the obvious problem of them currently linking to our .htm files, which will no longer be there)? Since the pages won't have conventional extensions of .htm, .asp, etc, how will this affect search engine rankings, if at all?


Yes, but only if you create a custom script map. .wcs and .wc will directly go to the file if one exists.

This is the best way to do ALL urls in Web Connection. Using wc.dll directly has all sorts of issues from security to the fact that you can't easily anchor your file's relative path. With script maps you can actually use relative paths much more easily because you have a fixed location for your script.

+++ Rick ---


Ahh, so first, it will look in the process class for a method named the same name as the filename? That would be perfect.

.wcs is a special case in that it's a script map that Web Connection handles directly as external scripts. So a .wcs page never fires any code in the application itself, only routes directly to the .wcs file and executes any scripts inside it.

If you set up your own scriptmap (.myScript for example) and you call say Helloworld.myScript it will:


  • First look in the Process class for a Helloworld Method and execute it if found
  • If no method is found it'll go and try to find the Helloworld.myscript page and execute as a template (or script)

So with your own script map you can choose whether you want to have a controller method fire. With .wcs and .wc there's no check for controller methods and it it will always try to execute the page on disk.

+++ Rick ---



So, let's say I'm going to use the stock .wcs extension for my page. The file name for my html page would then be MyPage.wcs, right? If I'm understanding this correctly, when the page is requested, wc.dll is going to process the page and serve it as an html page. Where do I specify which code is processed when the page is served? At the present moment, we're using urls like "wc.dll?ctwp~myfunction~blahblahblah", where "myfunction" is the function in the "ctwp" program to execute to process our data. Then, we return the page using "expandtemplate".

I'm sure I'm making this more complicated than it really is.

There's not a lot to set up actually. You only need to configure a script map and point it at your wc.dll.

If you look at the Web Connection examples all the script samples basically work this way (on the first page of 'classic' operations). All of the template examples run from code on disk. You may not even have to do anything if you use the stock extensions of .wc (template) .wcs (Script Page) which install by default and are handled by a Web Connection server automatically as long as the version is reasonably recent.

Otherwise you manually have to set the scriptmaps.

Holler if you need more information - it's easy to do.

+++ Rick ---



Sounds like exactly what I'm needing. Which sample would be the best to look at to get this set up?

Thanks!
Allen


If you're already usign Web Connection on your site, you can just use Web Connection pages as your default page (or whatever). Wouldn't that work?

All you need to do is map a script map (like myExt) and then call the page like:

default.myExt

which then fires into Web Connection. Web Connection defines default behavior for an extension when a local method is not found - it then tries to expand the physical file on disk using ExpandTemplate().

IOW, you don't need to have a 'dynamic' URL like wc.dll?blah~blah and in fact we strongly discourage that syntax in favor of script maps. Script maps can map either to dynamic URLs (if a method exists in the process class) or as a fallback loads the actual template directly.

I encourage you to take a look at the Web Connection samples, which use only script maps and exhibit both behaviors.

+++ Rick ---


I've been using Web Connection for some time now, but have always used regular html pages being called by "expandtemplate" to fill in all the data as the page is served to the client. The problem with this is that we have a few "static" html pages that I'm wanting to insert variables into when the page is served. For instance, on our home page, I would like to include information about the cart (how many items are in it and the total value). Of course, with it being a static html page, it isn't hitting any of my code; the server is simply serving the page. How could I make this work? Could this be accomplished by using ASP pages? If so, I've never done anything with ASP and don't really even know where to start. Where would I find good information on getting started with ASP and how does ASP interact with Web Connection (would I still use expandtemplate)?

Thank you for your time!

















Viewing all articles
Browse latest Browse all 10393

Trending Articles