Skip navigation

Tableau Filtering based on Account ID field.

You can also see this thread

 

http://www.tableausoftware.com/support/knowledge-base/integrating-trusted-tickets-portals

 

------------------------WEB CONFIG-----------------------

   

   

   

 

-------------------------ASP.NET CODE----------------------------

protected override void PageLoadEvent(object sender, EventArgs e)

        {

            base.PageLoadEvent(sender, e);

            string ticket = GetTableauTicket();//this will self distruct in 15 seconds

            frmTableau.Attributes.Add("src", ConfigurationSettings.AppSettings["TableauServer"] + ticket + ConfigurationSettings.AppSettings["DashBoardPath"] + "?:embed=yes&:toolbar=yes&account_id=" + SessionInfo.AccountId );

        }

 

        string GetTableauTicket()

        {

            ASCIIEncoding enc = new ASCIIEncoding();

            string postData = ConfigurationSettings.AppSettings["TableauServerUser"] + Page.Request.UserHostAddress;

            byte[] data = enc.GetBytes(postData);

 

            HttpWebRequest req = (System.Net.HttpWebRequest)WebRequest.Create(ConfigurationSettings.AppSettings["TableauServer"]);

            req.Method = "POST";

            req.ContentType = "application/x-www-form-urlencoded";

            req.ContentLength = data.Length;

           

 

            //Write the request

            Stream outStream = req.GetRequestStream();

            outStream.Write(data, 0, data.Length);

            outStream.Close();

 

            //Do the request to get the response

            HttpWebResponse res = (HttpWebResponse)req.GetResponse();

            StreamReader inStream = new StreamReader(res.GetResponseStream(), enc);

            string resString = inStream.ReadToEnd();

            inStream.Close();

            return resString;

        }