About Author

Justin Wendlandt
Justin Wendlandt
I work for Wells Fargo, play a lot of video games, and program in many languages. [ more ] E-mail me Send mail

View Justin Wendlandt's profile on LinkedIn

Calendar

<<  July 2008  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar

Recent Posts

Recent Comments

Comment RSS

Stock Quotes

WFC 23.92 +0.33 (+1.40%)
MSFT 25.98 +0.10 (+0.39%)
NVDA 12.49 -5.54 (-30.73%)
HAS 34.89 +0.41 (+1.19%)

XboxGamerCard

Jwendl
Jwendl
Gamer Score: 4725
Guitar Hero II (140) Rock Band (270) GTA IV (90) DYNASTY WARRIORS 6 (340) CSI-Hard Evidence (0) Culdcept SAGA (45) Overlord (420) Assassin's Creed (490) DEAD RISING (440) Halo 3 (535) Oblivion (390) Blue Dragon (25) Eternal Sonata (30) Tony Hawk's Project 8 (135) Gears of War (470) Crackdown (405)
Offline
2008-07-03T01:23:22-05:00
Last seen 07/03/08

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

Creative Commons License

Header Photo

Xbox 360 Gamertag without Iframes

January 4, 2008 00:06 by jwendl

I have developed a fairly decent way of getting my gamertag on my website side bar without using Iframes. It uses an API that was developed by Duncan Mackenzie. I just take the data and place it on my SideBar.ascx for BlogEngine. This script will work pretty much anywhere though.

private void XmlDownload()
   {
      try
      {
         string url = "http://duncanmackenzie.net/services/GetXboxInfo.aspx?GamerTag=jwendl";
         DataSet gamerDataSet = (DataSet)Cache["jwendl-gamercard"];
         if (gamerDataSet == null)
         {
            gamerDataSet = new DataSet();
            XmlTextReader xml = new XmlTextReader(url);
            gamerDataSet.ReadXml(xml);
         }

         Cache["jwendl-gamercard"] = gamerDataSet;

         DataTable xboxInfo = gamerDataSet.Tables["XboxInfo"];
         DataTable presenceInfo = gamerDataSet.Tables["PresenceInfo"];
         DataTable recentGameInfo = gamerDataSet.Tables["XboxUserGameInfo"];
         DataTable recentGame = gamerDataSet.Tables["Game"];
         DataTable modRecentGame = new DataTable();
         modRecentGame.Columns.Add("DetailsURL");
         modRecentGame.Columns.Add("Image32Url");
         modRecentGame.Columns.Add("Name");
         modRecentGame.Columns.Add("Score");

         for (int x = 0; x < recentGameInfo.Rows.Count; x++)
            modRecentGame.Rows.Add(new object[] { recentGameInfo.Rows[x]["DetailsURL"], recentGame.Rows[x]["Image32Url"], recentGame.Rows[x]["Name"], recentGameInfo.Rows[x]["GamerScore"] });

         gamerName.Text = Convert.ToString(xboxInfo.Rows[0]["Gamertag"]);
         gamerName.NavigateUrl = Convert.ToString(xboxInfo.Rows[0]["ProfileUrl"]);

         mainTag.ImageUrl = Convert.ToString(xboxInfo.Rows[0]["TileUrl"]);
         mainTag.Text = Convert.ToString(xboxInfo.Rows[0]["Gamertag"]);
         mainTag.NavigateUrl = Convert.ToString(xboxInfo.Rows[0]["ProfileUrl"]);

         gamerScore.Text = Convert.ToString(xboxInfo.Rows[0]["GamerScore"]);

         gameLinks.DataSource = modRecentGame.DefaultView;
         gameLinks.DataBind();

         gamerOnline.Text = Convert.ToString(presenceInfo.Rows[0]["StatusText"]);
         gamerSeen.Text = Convert.ToString(presenceInfo.Rows[0]["LastSeen"]);
         gamerLocation.Text = Convert.ToString(presenceInfo.Rows[0]["Info"]);
         gamerLocation.Text += Convert.ToString(presenceInfo.Rows[0]["Info2"]);
      }
      catch (Exception ex)
      {
         gamerTag.Visible = false;
         string foobar = ex.ToString();
      }
   }

 

<div class="box">
   <h1>Xbox Gamer Card</h1>
   <asp:Table ID="gamerTag" runat="server">
      <asp:TableRow>
         <asp:TableCell RowSpan="2" VerticalAlign="top"><b><asp:HyperLink ID="gamerName" Target="_new" runat="server" /></b><br /><asp:HyperLink ID="mainTag" runat="server" /></asp:TableCell>
         <asp:TableCell><b>Gamer Score: </b><asp:Literal ID="gamerScore" runat="server" /></asp:TableCell>
      </asp:TableRow>
      <asp:TableRow>
         <asp:TableCell>
            <asp:Repeater ID="gameLinks" runat="server">
               <ItemTemplate>
                  <asp:HyperLink ID="GameImage" Target="_new" NavigateUrl='<%# Eval("DetailsURL") %>' ImageUrl='<%# Eval("Image32Url") %>' Text='<%# Eval("Name") + " (" + Eval("Score") + ")" %>' runat="server" />
               </ItemTemplate>
            </asp:Repeater>
         </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow>
         <asp:TableCell ColumnSpan="2"><asp:Label ID="gamerOnline" runat="server" /><br /><asp:Label ID="gamerSeen" runat="server" /><br /><asp:Label ID="gamerLocation" runat="server" /></asp:TableCell>
      </asp:TableRow>
   </asp:Table>
</div>

You can see an example in my side bar. I would release source code for it, but there is no reason for it. I will only do it if there is a lot of interest, then it might be worth making it pretty.


Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading