.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

Getting SubString in WebMatrix

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :ASP.Net


In my WebMatrix app (.cshtml), I have a string and I want to extract a subsitring from it. I am using string.SubString(0,5) method but I am getting following error:

'string' does not contain a definition for 'SubString' and no extension method 'SubString' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)

I have included all required assemblies. Can I have suggestions please?.

View Complete Post

More Related Resource Links

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 shorthand coding?


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 ...

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

WordPress install error with WebMatrix


Hi All, when trying to install WordPress using WebMatrix I keep getting the following error:

blah blah blah   No connection could be made because the target machine actively refused it

I added a port open rule in Windows Firewall, ran a Netstat -an with nothing showing up as using that port, and still no love.  Anyone know what I'm doing wrong?

Thank you for sharing your knowledge if you do.

.NET BC : A Lap around WebMatrix; With a dash of Razor



Last night most of the DotNetnuke team and I traveled into Burnaby, to the BCIT campus where I gave a real quick (1 hour) presentation on the WebMatrix Beta, and Razor Syntax.

I was happy to see that we had over 60 people attend.  It was awesome to see the turn out on a hot summer evening. 

Download the Slide Deck

There were a number of questions which came up, I will try to remember them all here.


Working with Data - the db.Query() execution, can it be parametrized?

var db = Database.OpenFile("SmallBakery.sdf");
var selectQueryString = "SELECT * FROM Products ORDER BY Name";
@foreach (var row in db.Query(selectQueryString)){