Naweed Akram's Blog
<sharing: Knowledge />
Windows 8/RT WebAuthenticationBroker view issue - Alternative

Doing oAuth in Windows 8 couldn’t have been any easier and simpler. Remember the old days of getting Access Tokens from providers such as Yammer, GitHub, Facebook, 500px etc. (you name it). You had to use browser windows, passing URLs, manage the state etc. Windows 8 make it as simple as the code below to do all the underlying work for you. All you have to do is use the WebAuthenticationBroker, which presents the oAuth dialog, manages user authorization and state, and returns the access token, all with a few lines of code (3-4 lines).


However, there is a small issue. Some oAuth site present login/authorization dialogs which exceed the area displayed by WebAuthenticationBroker. This post addresses the problem and provides an alternative.

More ...
Tags:  .NET,  C#,  Silverlight Viewed:  26315       Comments:  9      

XGENO.DBMapper - A new way of OR/DB Mapping

XGENO.DBMapper is a simple, easy-to-use and powerful OR Mapper (just 15KB) for your database queries. It is set of extension methods (on the SQL Connection), which execute a SQL query (simple, parameterized, stored procs etc.) and return the data as a list of .NET objects (classes that you have created).


Note: This is not a replacement for existing ORMs (Linq/NHibernate/XGENO.ORM etc.). This is useful when there are lots of stored procedures or dynamic SQL queries are involved, and performance is a critical factor.

More ...
Tags:  .NET,  C#,  VB.NET,  ASP.NET,  MVC,  Silverlight,  ORM Viewed:  6143       Comments:  1      

Marketplace Browser and Downloader for Windows Phone 7 (with Source Code)

[Edit] Source Code has been released for this


Zune is a wonderful application for finding and installing Windows Phone 7 applications on your phone. The other alternative is to use Market Place application in WP7 handset. If have an HTC HD2 which doesn't support WP7 officially, but thanks to XDA Developers and DarkForcesTeam, I am running WP7 on this handset with no issues.

Initially, when I upgraded, I couldn't connect to Windows Market Place and browse or install applications because of Windows Live Services Registration (which I later resolved). So, I wrote an app to resolve my problem.

More ...
Tags:  C# Viewed:  7437       Comments:  6      

Descriptive Value for Enums in C#

Consider a scenario that you have the following enum declared, which is used to define SQL operations (keeping it very simple):

    public enum Operands


Now, if the user wants to convert the enums to values that SQL server can understand (=, <>, <, > etc.), the following needs to be done:

            string _opValue = "";
            Operands _op = Operands.LessThan;

            switch (_op)
                case Operands.Equals:
                    _opValue = "=";
                case Operands.GreaterThan:
                    _opValue = ">";
                case Operands.LessThan:
                    _opValue = "<";
                case Operands.NotEquals:
                    _opValue = "<>";


Not very convenient. What if, you could say:


            Operands _op = Operands.LessThan;

More ...
Tags:  .NET,  C# Viewed:  5963       Comments:  0      

RSS Feed Result for ASP.NET MVC

In this post, we look at creating a RSS Feed Result in ASP.NET MVC (similar to the one implemented on this site). This will allow your MVC site to expose its data (news, blog posts, articals etc.) as RSS feed.

More ...
Tags:  C#,  ASP.NET,  MVC Viewed:  31736       Comments:  2      

Date Badge - Revisited

In my previous post, we looked at creating a date badge for the posts in ASP.NET MVC (similar to the one on the side). However, it suffered from the issue of explicitly defining CSS styles, plus there was no strongly typed HTML helper to work with the model. 


Let's revise the code and build a better exntension.

More ...
Tags:  C#,  ASP.NET,  MVC Viewed:  4102       Comments:  0      

Creating a Date Badge for your Posts in ASP.NET MVC

Ever wanted to create a date badge for your posts in ASP.NET MVC (similar to the one on the side). It is actually very easy to do so.


Let's look at how this can be achieved with the help of simple CSS and a helper extension.

More ...
Tags:  ASP.NET,  MVC Viewed:  5826       Comments:  0      

RSS Feed

Quick Links