I need some ideas how to implement a URL Shortener Service with WCF along with sql server as database.
I will handle my url shortening logic with WCF. this project will handle creating short aliases for the urls and write them on the database with the actual url so that the project which will redirect the ulrs could use them.
where I need the logic ideas is on how to create short random letters. I will only allow numerical digits and letters in american alphabetic. Also;
I know that I will be using System.Random class inside the mscorlib.dll but honestly, do not know much about it. More detailedly, I do not have any idea how to create a random unique word with numerical digit and letters in american alphabetic.
You do not need a Random function. Randomness only gives you a chance for collisions.
Simply use an incrementing, numerical, key and encode it. Your database already provides a way to create them.
A simple encoding would be Hex (base 16) but you can get shorter and fancier with a base 32 (or higher) encoding. I'm not sure if the requirement for 'first char should be numerical' is useful but it's easy to accomplish.
And while a reversible encoding seems logical, it's also quite feasible to store the generated encoding as a column (Key) in the database and use that for lookup. That allows more fancy encoding, even adding a (random) digit in front.