Quantcast
Channel: eXpandFramework RSS
Viewing all articles
Browse latest Browse all 861

BLOG by Dennis Garavsky: Redirecting from an external hyperlink to a View in an XAF Web app with the ASP.NET Forms Authentication - YOUR FEEDBACK IS NEEDED

$
0
0
I wanted to ask the XAF community members interested in this functionality to test a simpler solution to the problem described in this thread. Long story short, you have a hyperlink to an XAF Web application form like this: 


and want to include it in an email and send it to a user so that he or she is able to navigate to that view on your web site (e.g., open a user profile or changed order details). If that app has a security system  with a logon form enabled, then the URL fragment after # is cut after a successful authentication, which makes navigation to the required app screen not possible by default. Instead, the URL fragment before the hash symbol is opened (see similar threads on StackOverFlow for more details: one, two, three).
There was a tricky solution to work around the default ASP.NET request processing mechanism in the original Support Center thread, but today I wanted to share a simpler solution for our users.



Here it comes:
1. In the Solution Explorer, right-click the YourSolutionName.Web/Login.aspx file and invoke the View Markup command from the context menu.
2. Paste the <script/> element with the JavaScript code below before the </body> element, as follows:



<body class="Dialog">
    <div id="PageContent" class="PageContent DialogPageContent">
        <form id="form1" runat="server">
            <cc4:ASPxProgressControl ID="ProgressControl" runat="server" />
            <div id="Content" runat="server" />
        </form>
    </div>
    <%--This part is added.--%>
    <script type="text/javascript">
    //<![CDATA[
    function encodeLocationHash() {
        var search = window.location.search;
        if (search && search.indexOf('ReturnUrl=') > -1) {
            var hash = window.location.hash;
            if (hash && hash.length > 1) {
                var newUrl = window.location.href.replace(hash, '');
                newUrl += encodeURIComponent(hash);
                window.location.replace(newUrl);
            }
        }
    }
    attachWindowEvent('load', encodeLocationHash);
    //]]>
</script>
</body>

This simple solution worked fine in many internal tests, but we wanted to make sure there are no tricky situations in your real apps, which are left uncovered.

I look forward to hearing from you on whether you:
Q1. ever experienced such a requirement in your XAF web sites.
Q2. got this new and simple solution working in your Web apps with the logon form.
Thanks in advance!

Viewing all articles
Browse latest Browse all 861

Trending Articles