Redirect from WebToLead forms using Request.ServerVariables("SERVER_NAME")?

Hello,

I am hoping someone can help me as I have exhausted my efforts with this one..

We have several domains with lead enquiries to capture into crm. Each time the lead is submitted, there is a Redirect.asp page set in the Web to Lead setting that looks at this value and reads which domain the lead form has come from and then runs through a Case statement to select the action to fire.

There are several ways to do this apparently but in this case, the domains are all separately hosted and named and I would think that capturing the "server_name" prior to submitting the lead form would be the best method. To do this, the server name must then be sent through to the Redirect.asp page and handled by the Case statement.

How do I capture the server name and send it with the form to be read by the Redirect.asp page? Are there any examples to help me?

My other question is, if the domains are not using IIS and not using ASP, do I also need to ensure the server names are captured using PHP and then transferred to a PHP case statement in the Redirect.asp page?

Thanks for any assistance you can offer.

Kind regards,

Penny Vaskess

  • 0

    Penny

    My understanding is that you need to capture the different server names that have hosted the original pages that are then submitted with the request.

    One object you can use is the JavaScript Location object.

    That has properties like href and origin and hostname that will identify the page and server you are on that can be passed with the form submitted.

    e.g.

    location.hostname

    or

    location.origin

  • 0

    Thanks Jeff..

    The windows.location.host works but the form is being posted on submit to return CreateAction() which directs it to the www.myserver.com/.../SubmitLead... etc..

    The redirect.asp page which has the case select statement to direct each incoming form to a designated thank you page, is not picking up the location variable which I have added to a hidden field in the web2lead form.

    I have googled and searched for a method to pick up the variable without using the Form Post method (as it is posting onSubmit to the function return CreateAction() ).

    See below:

    function CreateAction()

    {

    document.WEB2LEAD.action = "">myserver/.../SubmitLead

    }

    We have been told not to make any changes to the coding on the web to lead form so how do I get this data across to the redirect.asp page?

    Any ideas for me Jeff?

  • 0

    Thank you Dinesh.

    I understand how it works now. Kaan has been a huge help as well!

    Best Regards,

    Penny

  • 0

    Hi,

    As you have several domains with lead enquires to capture into crm. When a lead is submitted from any of your several forms, you will be first redirected to Redirect.asp page as this is set in the settings for Web to Lead under lead entity.

    Now, at this stage you want to determine the domain from which this lead was submitted. To get the domain name, you will have to use HTTP_REFERER in your redirect.asp page. Below is the code snippet for the same.

    var sURL = Request.ServerVariables("HTTP_REFERER")

    This will give the URL having name of domain from which lead was submitted. You can parse or split this URL to get the domain name from URL. Once you have domain name pass it to your case statement.

    Hop this helps!

    Regards,
    Dinesh