.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

WebMatrix shorthand coding?

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

Will there be support for shorthand statements?


@if(1==1) @: works
@else @: doesn't work

as apposed to;

    <text>doesn't work</text>

Or perhaps ternary opperators? PHP like stuff ...

View Complete Post

More Related Resource Links

Coding / Programming Tips for C#

Using proper guidelines and a template-framed style of coding will really helps developer to enjoy the coding with more understandable, reliable code and application development.

The void is invariant

while back I described a kind of variance that we've supported since C# 2.0. When assigning a method group to a delegate type, such that both the selected method and the delegate target agree that their return type is a reference type, then the conversion is allowed to be covariant. That is, you can say:

Best Coding Techniques To Improve Performance for SharePoint Applications

As more developers write custom code by using the SharePoint Object Model, they encounter common issues that can affect application performance.

The following areas reflect the main issues encountered by developers as they write custom code by using the SharePoint object model:

§ Disposing of SharePoint objects

§ Caching data and objects

§ Writing code that is scalable

Webmatrix error


When i try to do anything in webmatrix it shuts down.   i get this error in the log

pplication: WebMatrix.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: Unrecoverable system error.
   at System.Environment.FailFast(System.String)
   at MS.Internal.Invariant.FailFast(System.String, System.String)

DatabaseHelper for WebMatrix


After some initial trouble with database editor in the beta version of Microsoft WebMatrix, I decided it would be better to create SQL scripts and run them at startup of my web-app. Perhaps the Microsoft.Data.Database helper can be extend to support similar scenarios?

Here is the code: http://www.forkcan.com/viewcode/231/DatabaseHelper-for-WebMatrix

Keyboard shortcuts stops working in WebMatrix


I'm often experiencing that keyboard shortcuts stops working in WebMatrix. This is very annoying as CTRL-S, CTRL-C, CTRL-V, etc. stops working, all of which are heavily used when programming. It's obviously hard to explain how to reproduce this, but I was wondering if someone knows a quick-fix?

WebMatrix conversion failed when converting from a character string to uniqueidentifier?


I am trying to retrieve xml from a small function in my .cshtml page. Its throwing me an error. This however, runs fine in a console/form environment.

It takes 3 parameters and 1 exception.

myDll.GetXML(year, username, uniqueidentifier, out ex);

When I run this page I get the error, "Conversion failed when converting from a character string to uniqueidentifier."

Or a stack of.

System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting from a character string to uniqueidentifier.

   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()

   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()

   at System.Data.SqlClient.SqlDataReader.get_MetaData()

   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)

   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBeha

Any plans on releasing the source code for WebMatrix itself?


I tried reflecting into WebMatrix.exe but was unable.  I'm interested on how you integrated the WPF Ribbon & the Office-style sidebar.

Connecting to MS SQL Server database using webmatrix.



I am novice  user to raizor syntax using webmatrix and i am trying to connect MS Sql server database (instead of using .sdf file i am using .mdf file) using the tool webmatrix for startersite.

The connection string that i setup as follows.

<?xml version="1.0"?>


        <compilation debug="false" targetFramework="4.0" />
    <add name="OESConnectionString" connectionString="Data Source=.\SQLServer2005;AttachDbFilename=|DataDirectory|\OES_Data.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />


And i am using websecurity helper as well and the setup is as follows.

WebSecurity.InitializeDatabaseConnection("Data Source=INLTE5556\\SQLServer2005;Initial Catalog=OES;Integrated Security=True", "System.Data.SqlClient", "UserProfile", "UserId", "Email", true);

When i am trying to insert the user details into database i am getting the below error.

Format of t

User messages without hard coding


Hi All,


How to manage user messages to avoid hardcoding messages accross the web application.





Invalid length for a Base-64 char array for my coding in ASP.net C#. How to solve it ?


Hi Friends ,

I have done encrypted password and decode but i got error  like  this  " Invalid length for a Base-64 char array" .

Pls help . Thanks


psswd = txtPassword.Text;

pwed = base64Decode(psswd);

public string base64Decode(string sData)
            System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
            System.Text.Decoder utf8Decode = encoder.GetDecoder();
            byte[] todecode_byte = Convert.FromBase64String(sData);
            int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
            char[] decoded_char = new char[charCount];
            utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
            string result = new String(decoded_char); return result;

Better Coding: Better Coding with Visual Studio 2010


From functional IDE improvements to better support for parallel programming, Visual Studio 2010 comes with a host of new features to help meet the needs of today's demanding, ever-changing development environment. Doug Turnure provides an overview of the more important ones and practical advice on how to use them.

Doug Turnure

MSDN Magazine April 2010

Coding Tools: Improved Support For Parallelism In The Next Version Of Visual Studio


We take a look at planned support for parallel programming for both managed and native code in the next version of Visual Studio.

Stephen Toub and Hazim Shafi

MSDN Magazine October 2008

Toolbox: Realistic Test Data, Dare Obasanjo's Blog, Color-Coding Tools, and More


This month Scott shows how to generate realistic test data, visits Dare Obasanjo's blog, and demonstrates color coding code for better readability.

Scott Mitchell

MSDN Magazine October 2008

Toolbox: Save Coding Time, Manage Compressed Files, and More


Save Coding Time, Manage Compressed Files, and More

Scott Mitchell

MSDN Magazine January 2007

Data Points: Efficient Coding With Strongly Typed DataSets


Someone once said to me that the hallmark of a good developer is the desire to spend time efficiently. Developers are continually pursuing ways to make coding easier and faster, and to reduce the number of errors.

John Papa

MSDN Magazine December 2004

App Lockdown: Defend Your Apps and Critical User Info with Defensive Coding Techniques


Whether you're storing database connection strings, user credentials, or logon info, you'll need to practice good defensive programming techniques to avoid those surprise situations in which your data is exposed. In this article, author Kenny Kerry shows you how.

Kenny Kerr

MSDN Magazine November 2004

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend