locked
want to capture URL and forward to friend ??? RRS feed

  • Question

  • User-631683198 posted

    hi,

     

    I am using  Intelligencia URL rewriting solution.

    my actual web page is something like www.mydomain.com/Profile.aspxId="xxxx"

    but using the Rewriting solution the visitor on the page will see

    www.mydomain.com/MatsProfile

     

    On this aspx page, i have a form that users can

    forward to a friend with the URL address.

     

    In the page load I grab the URL using the code below

     string tom = Request.RawUrl;
            Session["friendPage"] = tom;

     

    then in button click event I compose the mail message class

    and send the below mail.Body = "hey, check out this page " + "<a href='http://www.mydomain.com/" + (string)Session["friendPage"] + "'>Visit your friend</a>";

     

    when the email is received and the link clicked it goes to the

     

    to www.mydomain.com/Profile.aspxId="xxxx"

    so the session code is capturing the above URL but I would rather it

    stores the www.mydomain.com/MatsProfile  as the link.

     

    is this possible

    thank you

     

    Friday, October 8, 2010 6:29 AM

Answers

  • User-42918493 posted

    Get url by javascript and send that..

    <script language='javascript'>
    window.onload = function()
    {
        
        document.getElementById('<%= hfURL.ClientID %>').value=location.href;
    }
    </script>
        <asp:HiddenField ID="hfURL" runat="server" />

    hfURL.Value will give you browser url



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, October 9, 2010 2:24 AM
  • User-631683198 posted

    thank you.

     

    In the mail message code on page behind can I just access the hfURL

    as normal or do i need to put any more code in.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, October 9, 2010 11:29 PM

All replies

  • User-42918493 posted

    Get url by javascript and send that..

    <script language='javascript'>
    window.onload = function()
    {
        
        document.getElementById('<%= hfURL.ClientID %>').value=location.href;
    }
    </script>
        <asp:HiddenField ID="hfURL" runat="server" />

    hfURL.Value will give you browser url



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, October 9, 2010 2:24 AM
  • User-631683198 posted

    thank you.

     

    In the mail message code on page behind can I just access the hfURL

    as normal or do i need to put any more code in.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, October 9, 2010 11:29 PM
  • User-631683198 posted

    hi,

     

    can you show me  an example in the aspx page as i cannot

    get it working.?

     

    Monday, October 18, 2010 7:58 AM
  • User-42918493 posted

    are you getting any error?

    Tuesday, October 19, 2010 12:33 AM
  • User-631683198 posted

    Hi,

    I just get the below showing in a label

    System.Web.UI.WebControls.HiddenField - instead of URL ?

     

     

    Aspx Page

    <!

    DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <

    <

    html xmlns="http://www.w3.org/1999/xhtml">head runat="server">

     

    <title></title>

     

    <script type="text/javascript" language="javascript">

    window.onload =

    document.getElementById(

    }

    function () {'<%= hfURL.ClientID %>').value = location.href;

    </

    script>

     

     

    </

    <

    head>body>

     

    <form id="form1" runat="server">

     

    <div>

     

    <asp:HiddenField ID="hfURL" runat="server" />

    <

    asp:label runat="server" ID="Label1"></asp:label>

     

    </div>

     

    </

    </form>body>

    </

    html>

     

     

    Code Behind

     

    Label1.Text = hfURL.ToString();

     

    Tuesday, October 19, 2010 6:03 AM