Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
Is there any way to get the current URL (referer) inside a form as hidden variable?
for example inside my form i get the following:
<form action=""><input type="hidden" name="referer" value="CURRENT-URL">
Thanks
This should work in XSLT
<input type="hidden" name="referer" value="{umbraco.library:Request('UrlReferrer')}"/>
Rich
sorry i think it was a little bit unclear.
I do not need it in xslt i just want to get the current page URL inside a hidden form tag to use it as refererer url inside a usercontrol.
So just want to know how to get the current URL of the site inside a hidden Variable
Something like this
<form action=""><input type="hidden" name="referer" value='<%="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL")%>'></form>
hi Rich,
Now i get the following error:
Non-invocable member 'System.Web.HttpRequest.ServerVariables' cannot be used like a method.
I found it out
It must be
<input type="hidden" name="referer" value='<%="http://" + Request.ServerVariables["SERVER_NAME"] + Request.ServerVariables["URL"]%>'>
My mistake
<form action=""> <input type="hidden" name="referer" value='<%="http://" & Request.ServerVariables["SERVER_NAME"] & Request.ServerVariables["URL"]%>'> </form>
Cross post, glad you got it working!
Just for info, I think you can achieve the same with this:
<input type="hidden" name="referer" value='<%=Request.Url.AbsoluteUri%>'>
With the advantage that you do not hardcode the "http" part (can be handy if some parts of the site fall in https for example).
Cheers,
Michael.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Get referer as hidden variable in template
Hi,
Is there any way to get the current URL (referer) inside a form as hidden variable?
for example inside my form i get the following:
<form action="">
<input type="hidden" name="referer" value="CURRENT-URL">
Thanks
This should work in XSLT
<input type="hidden" name="referer" value="{umbraco.library:Request('UrlReferrer')}"/>
Rich
sorry i think it was a little bit unclear.
I do not need it in xslt i just want to get the current page URL inside a hidden form tag to use it as refererer url inside a usercontrol.
So just want to know how to get the current URL of the site inside a hidden Variable
Something like this
<form action="">
<input type="hidden" name="referer" value='<%="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL")%>'>
</form>
Rich
hi Rich,
Now i get the following error:
Non-invocable member 'System.Web.HttpRequest.ServerVariables' cannot be used like a method.
I found it out
It must be
My mistake
Cross post, glad you got it working!
Hi,
Just for info, I think you can achieve the same with this:
With the advantage that you do not hardcode the "http" part (can be handy if some parts of the site fall in https for example).
Cheers,
Michael.
is working on a reply...