If a page 'A' is opened, find out from which source page page 'A' has been called? - asp.net

I am currently in "pageA.aspx". Using top.location.href or Response.Redirect(), I've come to "pageB.aspx". How to find out that which page has called "pageB.aspx". Is it "pageA.apsx" or any other page.
I aware of using URL Query-String. But I need to use any other option.

You can use Request.UrlReferrer.
Gets information about the URL of the client's previous request that
linked to the current URL.

Related

Send information from elementor form to another page with the modified data

I'm building a wordpress site with elementor pro.
I want to make a form (in which you enter some numerical data as metric cubes and other numbers) that redirects you to another page where that data is transformed. How can I do that?
maybe you can use a template with html javascript linked by an external link button
When redirecting to the other page (eg: site.com/other-page) you could include the "numerical data" as a Query String directly in the redirected URL (eg: site.com/other-page?data=1234). Then, upon initial loading of the other page, the data can be retrieved from the URL

Google Tag Manager - Count visit on lazy load post

I have a Wordpress page, and I developed an "Infinite Scroll" for posts. When I am reading a post and scroll to bottom, the page load another post using Ajax (and change the URL) but without windows refresh.
I need (my client) that when someone scroll down and a new post is loaded, that load count a visit on Google Tag Manager, as if that person should enter to that post directly.
Is this possible?
Thank you.
Try history change trigger. It often helps when the URL changes without page loads.
A proper solution here, however, would be modifying the lazy loading function to issue a dataLayer event whenever a new post is loaded.
Another hack for it would be using the visibility trigger. And use it for, let's say, your post headers. And then pass that header in an event.
Then you will be able to conduct classical per-post impressions-to-clicks analysis. CTR, basically.

Tag Manager Trigger with Value of Originating Link Page

With Google Tag Manager, I want to create a tag that tracks the originating page that links to a form that is in an Iframe, why is a form in an Iframe, because I deal with netsuite, I know, horrible. Anyways, I want to be able to submit the form and pull the url or element by id from the original page where it was linked from. No cross domain as it is all within the same domain. Thank you all for any help.
Well for Form ID and Page url you will need you have predefined variable in GTM
http://take.ms/PPdTj
And for Url of the page on which the iframe exist you would have to modify the href of the iframe and append a parameter with required page url
and then extract the query param using gtm

Drupal: simple form forwarding data to another server

I need to add a page with a form in my Drupal website. This form should be submitted to another server (there is a php script ready to receive it on such server).
So, I don't need any database update, just a page forwarding the data inserted by users to another domain.
Do you know what's the easiest way to do it ?
thanks
ps. Also, I need to create a drop down menu with a list of countries (and regions for each country) as submenu
I am surprised noone mentioned hook_form_alter and setting #action to an external URL. This will make the form post directly to the other server if you have control of it you can easily redirect back. Lot easier than POSTing from your server. Another way would be to iframe the other script and use the target attribute (set $form['#attributes']['target'] = 'the_iframe' in hook_form_alter). Then you can use JS to 'move' the page after the submit. Upload POSTs to an iframe, you can look into that JS as well. How do you post to an iframe? discusses iframes and forms.
In your form, you can set #action to whatever URL you want. It will post to that url. If you need a GET, instead of a POST, you should also set the #method.
function my_form_builder() {
$form['search'] = array(
//..builds some form elements
);
$form[#action] = 'http://example.com';
return $form;
}
You could create a regular drupal form with the ususal validation stuff and instead of putting the date into the DB send it over to the other site (via post or get or whatever).
To POST to an external URL in your own custom form implementation or using hook_form_alter() to add another submit handler to an existing form, while not showing the request you will want to use drupal_http_request() to send a serverside http request. See this:
http://www.drupaler.co.uk/blog/validating-submitting-forms-other-websites-drupal/428
To accomplish this with the webform module you'll need what you learned above and something like the following:
In D6 /Webform < 3
http://drupal.org/node/543674#comment-2499674
In Drupal 7/Webform 3
http://www.midwesternmac.com/blogs/jeff-geerling/integrate-webform-3x-paypal

How to get file name of any page regardless of URL?

I would like to force SSL on certain pages around the site, like for login, registration etc. by specifying a string array and checking whether the current URL fits a certain criteria in a custom HttpModule.
It works well, as long as the URL correctly reflects the page, however I use routing tables, so some requests I point to login page, if a page requires login, and I end up with a login page on the screen and with an URL for members' area.
Is there a way to find the actual file name of a page?
Example:
http://www.mysite.com/login - file name is login.aspx, which is not reflected by the url.
http://www.mysite.com/members - file name is still login.aspx if a user is not logged in.
Instead of using the URL, could you use the class name?
If TypeOf(Page) Is LoginPage Then
End If
System.IO.Path.GetFileName(HttpContext.Current.Request.FilePath);

Resources