Sharing from Windows Phone 8

using Microsoft.Phone.Tasks;

private void ShareLink()
ShareLinkTask shareLinkTask = new ShareLinkTask()
Title = "Code Samples",
LinkUri = new Uri("", UriKind.Absolute),
Message = "Here are some great code samples for Windows Phone."


private void ShareEmail()
EmailComposeTask emailComposeTask = new EmailComposeTask()
Subject = "message subject",
Body = "message body",
To = "",
Cc = "",
Bcc = ""


private void ShareSMS()
SmsComposeTask smsComposeTask = new SmsComposeTask()
Body = "Try this new application. It's great!"


Every application needs identity & access control

Nearly every application deals with data and resources that need to be protected. Implementing secure authentication and authorization is therefore an essential requirement in most cases.

Guide-To-Claims-Based-IdentityWhile historically the solution to that problem has been either Windows authentication or username/password, this might not hold true anymore. In the distributed and mobile application landscape, passwords have become an anti-pattern, and single sign-on, security token services and federation are the prevalent technologies to achieve a seamless security experience for your users.

We have worked in this space for several years, and our lead security consultants have in the past published books and open-source software toolkits to simplify identity management and access control for your .NET-based applications.

You can find Identity Server on GitHub and on Amazon.

Five documentation apps for .NET developers

Documentation is a necessary evil for software developers. While C# and VB.NET have basic facilities for commenting code and embedding XML documentation into code, turning that into a more useful form is outside the realm of Visual Studio. These five applications can help you turn your comments and notes into proper documentation.


1: Sandcastle

Sandcastle is probably one of the best known documentation generators for .NET, and it has the benefit of being open source. Unfortunately, Sandcastle is difficult to use on its own, prompting a small cottage industry of add-ons and helpers to make working with it easier. Even so, Sandcastle is a capable tool and a great starting point for turning your XML comments into documentation.


2: Document! X

Innovasys' Document! X handles a lot more than .NET documentation, including COM and database documentation. It is loaded with features, such as the ability to generate help files that integrate directly into Visual Studio's help; that is a must-have for developers writing libraries. Document! X may be one of the most expensive options around, but it could very well be worth the price for your team.


3: Doc-O-Matic

Doc-O-Matic is a recent entry to the code documentation space. In addition to being able to produce code for .NET, it can work with C/C++, Java, JavaScript, and PHP. Along with documenting the source code, it can also create application-level help. It comes in a variety of editions, allowing you to pick the one that meets your needs and keep your costs down. (The top end edition is quite pricey)


4: Doxygen

Another open source choice is Doxygen. Like Doc-O-Matic, Doxygen can handle a number of non-.NET languages. In fact, with its basis in the *Nix world, Doxygen's .NET support is rather limited (it supports only C#). That said, if you are working in a cross-platform environment, or with C# code under Mono, Doxygen may be a great choice. One unique feature is that it can produce LaTex output.


5: VSdocman

VSdocman adds an interesting twist to the documentation genre by including a Visual Studio plug-in that does comment editing directly inline. This comment editor is a big improvement over trying to do formatting and markup by hand in the XML comments. It also can automatically create basic comments based on the code itself. VSdocman is also fairly inexpensive compared to some of the other options.

IIS 7.5 error: Handler “PageHandlerFactory-Integrated” has a bad module “ManagedPipelineHandler” in its module list

Today I installed Clean Windows Web Server 2008 R2 64-bit with IIS 7.5. To my surprise opening .NET 4.0 application I received the following error:
IIS 7.5 Detailed Error - 500.21 - Internal Server Error
Server Error in Application "DEFAULT WEB SITE"
Internet Information Services 7.5
[Error Summary]
HTTP Error 500.21 - Internal Server Error
Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list

[Detailed Error Information]
Module IIS Web Core
Notification ExecuteRequestHandler
Handler PageHandlerFactory-Integrated
Error Code 0x8007000d
Requested URL http://localhost:80/default.aspx
Physical Path C:\inetpub\wwwroot\default.aspx
Logon Method Anonymous
Logon User Anonymous

[Most likely causes:]
•Managed handler is used; however, ASP.NET is not installed or is not installed completely.
•There is a typographical error in the configuration for the handler module list.

[Things you can try:]
•Install ASP.NET if you are using managed handler.
•Ensure that the handler module's name is specified correctly. Module names are case-sensitive and use the format modules="StaticFileModule, DefaultDocumentModule, DirectoryListingModule".

[Links and More Information]
IIS core does not recognize the module.
View more information »
As it turns out, some glitch caused this problem, and somehow .NET was not registered with IIS.
Running the following commands solved this issue:
%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe –i

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

Convert VB to C# or C# to VB

Same link to convert you code from C# to VB or viceversa.

CSS not loading from App_Themes

I am having problem while loading the CSS file through App_Themes folder but with ASP.NET authentication doesn’t work. The solutions are two. First it’s insert in web.config this tag:

<configuration> <location path="App_Themes/YourThemeFolder"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> </configuration>

The second solution (that it’s always working) is changing tag page on web.config.

<pages styleSheetTheme="YourThemeName"> </pages>

How to calculate the sum of the DataTable column in

To calculate the sum of a column in a DataTable use the DataTable.Compute method. Example of usage from the linked MSDN article:

DataTable table; table = dataSet.Tables["YourTableName"]; // Declare an object variable. object sumObject; sumObject = table.Compute("Sum(Amount)", "");

Another way:

datatable.AsEnumerable() .Where( y => y.Field<string>( "SomeCol" ) != "foo" ) .Sum( x => x.Field<int>( "MyColumn" ) ) .ToString();

Linqer (SQL to Linq converter)

Linqer is a SQL to LINQ conversion tool. It helps learning LINQ and convert existing SQL statements.
logo_linqer Not every SQL statement can be converted to LINQ, but Linqer covers many different types of SQL expressions. Linqer supports both .NET languages - C# and Visual Basic.
Because LINQ is a part of the C# and VB languages, it is sensitive to data type conversion. Linqer performs required type castings in the produced LINQ statements.
It can convert the most usable SQL Server functions. The full list of supported MSSQL functions can be found here.
You need to have Microsoft .NET Framework 4.5 ,Microsoft .NET Framework 4.0 , or Microsoft .NET Framework 3.5 installed on your computer to be able to use Linqer. Visual Studio needs to be installed, in order to use the SqlMetal tool to generate LINQ to SQL model files or the EdmGen tool to generate LINQ to Entities model files.


  • Generate LINQ to SQL or LINQ to Entities modeling files such as .dbml or .edmx.
  • Create a Linqer Connection, which consists of a database connection string, model type(LINQ to SQL or LINQ to Entities), programming language (C# or VB),  and generated or existing modeling files.
  • The Linqer Connection Pool allows the management of stored connections.
  • The multiple tabs interface is designed to work with multiple Linqer connections at the same time.

Split String in C#

String class provides the Split method that is used to split a string delimited with some specified characters. It identifies the substrings that are delimited by one or more characters specified in an array, and then return these substrings in a string array. Delimiter characters are not included in the substrings.
The Split function has forms like this:
  • string[] Split(params char[])
  • string[] Split(params char[] separator)
The Split function returns one of these:
  • An array consisting of a single element containing the entire string if the string contains none of the characters in the separator list.
  • An array of substrings if the string is delimited by one or more of the characters specified in the separator list passed in the Split method.
  • An array of substrings in a string delimited by white space characters if those characters occur and the separator array passed is a null reference or contains no delimiter characters.
  • String.Empty (a static read-only field that represents the empty string) where two separators are adjacent or a separator is found at the beginning or end of the string.
For example, if we want to split string 38,\n29, 57 with a character array separator list containing comma and space characters, we will get "38", "", "29", "", "57" as string array elements returned. Or, if we want to split string "38..29..57" with the character array delimiter list containing a period '.' , we will get "38", "", "29", "", "57" as string array elements.
Here is a complete example of using various separators to split different strings.
class Program
static void Main(string[] args)
{ // Some strings with separated by space, comma, and a substring
string intSpacedString = "1 3 5 7 9";
string charCommaString = "a, e, i, o, u";
string nameCommaString = "Mahesh,Raj,,,Dinesh,Mike,Praveen,Joe,Lana";
string subStringString = "12KKK34KKK56KKK78KKK";

char[] spaceSeparator = new char[] { ' ' };
char[] commaSeparator = new char[] { ',' };
string[] stringSeparators = new string[] { "KKK" };
string[] result;

Console.WriteLine("Space separated strings :\n");
result = intSpacedString.Split(spaceSeparator, StringSplitOptions.None);
foreach (string str in result)

Console.WriteLine("Comma separated strings :\n");
result = charCommaString.Split(commaSeparator, StringSplitOptions.None);
foreach (string str in result)
result = nameCommaString.Split(commaSeparator, StringSplitOptions.None);
foreach (string str in result)

Console.WriteLine("Substring separated strings :\n");
result = subStringString.Split(stringSeparators, StringSplitOptions.None);
foreach (string str in result)

C# string to Formatted HTML string

Is there a tool out there that can turn a C# string of unformatted HTML (no indentions, no new lines, etc) into a Formatted HTML string?
I am in a situation where I am generating an HTML string, and I am outputting it into a multiline textbox. Write now, it is wrapping, but is showing up similar to a paragraph. I would like it to be shown as formatted HTML? It wouldn't even have to be very nice formatting, but at least not show a paragraph of HTML.
For having a good formatted HTML you can use this code:
formattedOutput = System.Xml.Linq.XElement.Parse(myHtmlString).ToString();
catch { // isn't well-formed xml }