View RSS Feed

Development Team Blog

Guiding Visitors of Your Website Directly to the Important Page

Rate this Entry
Linking from another site to a specific page at your site, informing people about the specific topic at your website in a magazine or an e-mail (newsletter) can be done in different ways.

One of the ways involves using the full URL like: http://www.dataaccess.eu/News.asp?pageid=2174. This works but the downside of such an URL are:
  • The URL is too long
  • People will make typing errors causing them not to go to the desired page
  • If the page is deactivated over time dead links will be present in search engines, which on its turn make your site less wanted
  • The same is valid when people use the URL from a magazine that was kept for a while.

A URL like http://www.dataaccess.eu/vrwdownload would offer more flexibility over time. The link can point to a certain page now (like Visual Report Writer version 1.4 download) and link to another page as soon as a new release is ready. Now, how can you make such a relative link?

First, within Internet Information Services (IIS) Manager you can create a virtual directory inside your website. In this virtual directory you place an ASP file (e.g. default.asp) in that folder which links to the right page on the website. The default page can contain one ASP instruction such as: <%Response.Redirect("http://www.dataaccess.nl/GlobalAccountDownload.asp?pageid=2173")%>. This works OK but it requires your web-server administrator for the IIS virtual directory or a password to access the server at that level yourself. So not really perfect. Certainly not if you need to do this more often.

A better idea is to do the same fully from inside Electos Studio without the need for a virtual directory. You need to go the design part of the Studio and add a folder with the value after the backslash (e.g. vrwdownload). In this folder you create the same default.asp with the same redirect information as above. Now you have a relative URL without the use of the webserver administrator.

Even more better is that you never have to go into the ASP file again to change the page ID. Of course you can do this with Electos too. For this you need to assign a label to the destination page. Labels are unique for the website and are assigned to the page in the page properties. As soon as you create a new page you remove the label from the old page and assign it to the new page. For the use of a page by label you need to add the following code inside an ASP file named "PageByLabel.Asp". Place the file in the root design folder for the website (this is the AppHtml folder). You can do this fully inside the Electos Studio.

Code:
<%
    Dim iRedirectPageId, sLabel

    sLabel = request("label")
    
    '   Get the pageid using the label
    If (sLabel <> "") Then    
        iRedirectPageId = oPublisher.call("Get_PageIDByLabel", sLabel)
        ' Check if the page is active
        If (iRedirectPageId > 0) Then
            iRedirectPageId = oPublisher.call("Get_PageId", iRedirectPageId)
        End If
    Else
        iRedirectPageId = 0
    End If
    
    '   Check if a page is found
    If (iRedirectPageId > 0) Then
        '   4.1 and newer
        Response.Redirect(oPublisher.call("Get_PageURL", iRedirectPageId))
        
        '   If you use Electos 4.0 and older make the following code active and deactivate above one
        'Response.Redirect(oPublisher.call("Get_WebsiteURL") & oPublisher.call("Get_ASPTemplate", iRedirectPageId) & "?pageid="  & iRedirectPageId)
    Else
        Response.Write("Could not find this page, click here to return to the home page.")
    End If
%>
Now you can change the contents of your default.asp into <%Response.Redirect("http://www.dataaccess.eu/PageByLabel.asp?label=vrwdownload")%> and work with labels and "virtual folders" quite easy and flexible.
Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Virtual Directory.jpg 
Views:	750 
Size:	152.7 KB 
ID:	4043   Click image for larger version. 

Name:	Select Add Folder.jpg 
Views:	545 
Size:	82.3 KB 
ID:	4044   Click image for larger version. 

Name:	Enter New Folder Name.jpg 
Views:	837 
Size:	26.8 KB 
ID:	4045  

Updated 2-Dec-2013 at 02:32 AM by Vincent Oorsprong (Images enlarged)

Categories
Uncategorized

Comments