Passing Customer Portal Credentials to the SalesLogix Customer Portal – Without Logging in

I would imagine that it is a common request for many companies that use the SalesLogix customer portal to allow their customers to create tickets to want to bypass the login screen since they might be launching the customer portal from some other customer site where the customer has already logged in. This is a reasonable request. If you’ve already validated the customer when they logged into some other customer portal or site, you don’t want to have them log in again when you launch the customer portal for them.

Fortunately, this is a simple thing to do, all thanks to the wise decision made by Sage to use standard ASP.NET Forms authentication for the SalesLogix 7.2 Customer Portal. Let’s take a look at how to set this up. We’ll make it so we can pass a SalesLogix customer portal user name to the customer portal and have it automatically log that user in – all without the user ever seeing a login screen!

First of all, create a new aspx file in the root of the customer portal site. We’ll name this CustomerPass.aspx. Now, open the file in a text editor and add the following to it:

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Security" %>

<script language="C#" runat="server">

private void Page_Load(object sender, EventArgs e)
{
    string customer = this.CustomerUser;
    if (customer.Equals(string.Empty))
        Response.Write("Invalid customer user.");
    else
        FormsAuthentication.RedirectFromLoginPage(customer, false);
}

private string CustomerUser
{
    get
    {
        // you might also want to query the SLX database to ensure
        // that the passed customer user name really exists
        return Request.QueryString["customer"] ?? string.Empty;
    }
}

</script>

That is simple enough. What this does is take a user name, passed in the QueryString in a parameter named “customer” and uses that to validate the user for the customer portal.

Now, we’ll need to make the CustomerPass.aspx page the login page for the ASP.NET Forms authentication for the customer portal. Open up the web.config file for the portal and look for the authentication section. Change the loginUrl attribute from “default.aspx” to “CustomerPass.aspx”. Now save the file. You can even delete the Login.aspx now if you wanted to (but you don’t need to).

Now, to test this, all you have to do is go to the customer portal with the following URL, changing the myusername at the end with a valid SalesLogix customer portal user name:

http://MYSERVER/SlxCustomerPortal/CustomerPass.aspx?customer=myusername

Pretty cool, right? You web right to the ticket list and never saw a login screen. You can verify that you’re logged in as the right user as well by checking the wecome message at the top left of the page!

Obviously, something like this could be abused, so you’ll need to weigh in the risks, and maybe even pass along some other coded value in the querystring as a safety measure.

ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

1 Comment

  1. Hi Sir, i would like to ask how to connect to other database in slx web 7.2 my connection string is giving me an error not trusted connection. pls email me at janvincent_08@yahoo.com

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!