Posts Tagged ‘ASP.NET’

Microsoft WebMatrix, more than a toy

Tuesday, March 8th, 2011
Autor: ricardo.fiel


Not long ago, Microsoft released WebMatrix, a new development tool that aims to make web development easy. At first, I wasn’t very convinced with it, and I was quite happy with Visual Studio 2010 for my web dev work. Did we really need another development tool for the Microsoft web stack? Visual Studio even has a free express version, so I didn’t quite get why WebMatrix was needed.

This post starts with an introduction to what is WebMatrix and I’ll share my experiences for real world projects with it in the end. And no, I didn’t stop using Visual Studio wlEmoticon smile Microsoft WebMatrix, more than a toy.

At one of our tech lunches (a regular event at Fullsix Portugal where we get the whole server team together, order great food – and chocolates! – and watch a tech-related video), we watched the CodeMash 2011 Keynote video where WebMatrix was launched.

It blew me away. If you haven’t taken WebMatrix for a spin, watch the video. You’ll find a lot of great demos and get to see some of the coolest features in action. Josh Holmes leads the way (a great speaker) and invites people from DotNetNuke and Joomla to show how you can leverage WebMatrix to get up and running with no time with those platforms. Wait, did I just say Joomla? Yes, it’s not ASP.NET + SQL Server only… Let’s have a closer look, shall we?

When you start WebMatrix, you’re presented with 4 options:

image thumb Microsoft WebMatrix, more than a toy

The most interesting, IMHO, is the “Site from Web Gallery”. This lets you choose an open-source web application as the foundation for your website. It can go from CMS systems to e-commerce, forums and more. You’ll find products based on the Microsoft stack like Umbraco, YAF.NET, Kentico and others, but you’ll also find PHP+MySQL stuff like Joomla!, WordPress and Drupal. Choose one and you’re set to go.

How I’m using WebMatrix

WebMatrix takes care of finding all the required dependencies to have your website running, so if that means installing MySQL, then you don’t have to worry about it. It’s all taken care of. There’s a lot more to WebMatrix, like features to make publishing a snap, statistics and more, but the “Site from Web Gallery” is the feature I’ve been using the most.

A lot of the times, I need to have a website up and running in no time. This can be for trying out some things or to showcase some feature at a client meeting, and I don’t have the time to go though all the hassle of creating a web application in Visual Studio, downloading the platform, database, configure everything, etc… With WebMatrix, it really takes a couple of seconds and you’re running. This is what made me a fan of WebMatrix. It’s click, click, choose some passwords for your database, and your site is running in IIS Express. You can now customize anything you want in your website, as you have the WebMatrix IDE with all the files and database tools you’ll need until your project gets big.

After prototyping, we can choose to continue the work in Visual Studio simply clicking a button (Launch Visual Studio). This is how I go when I decide to use the work I started in WebMatrix. I never use the publish feature and I migrate the database to one of our servers, so it’s integrated with our typical ALM process.

And did I mention Razor is fully supported? wlEmoticon smile Microsoft WebMatrix, more than a toy

Let me know how you’re using WebMatrix.

Until next time.

Umbraco – Write Permissions

Tuesday, October 13th, 2009
Autor: nuno.lourenco


Para quem usa umbraco, aqui deixo uma lista dos directórios que necessitam de ter permissões de escrita/modificação:

bin
config
css
data
media
umbraco
usercontrols
xslt

Happy coding icon smile Umbraco – Write Permissions

Forms Authentication em 15 minutos

Friday, August 7th, 2009
Autor: Nuno Costa


Se quisermos ter um site ou parte dele accessivel apenas por utilizadores registados esta é uma forma rápida de implementar forms authentication.

 

Criar uma página para autenticação e adicionar um controlo login

logincontrol thumb Forms Authentication em 15 minutos

No evento Authenticate do controlo colocar o seguinte código :

protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
    if (FormsAuthentication.Authenticate(Login1.UserName, Login1.Password))
    {
        FormsAuthentication.RedirectFromLoginPage(Login1.UserName, Login1.RememberMeSet);
    }
    else
    {
        Login1.FailureText = “username/password inválidos”;
    }
}

Agora só é preciso configurar o web.config

<authentication mode=”Forms” >
      <forms defaultUrl=”Default.aspx” loginUrl=”Login.aspx” name=”authCookieName” >
        <credentials passwordFormat=”Clear”>
          <user name=”admin” password=”passwordAdmin”/>
        </credentials>
      </forms>
    </authentication>
    <authorization>
      <deny users=”?”/>
    </authorization>

Automaticamente o input do utilizador vai ser validado contra as credenciais presentes no web.config.

ASP.NET Textbox TextMode = Password

Tuesday, August 4th, 2009
Autor: nuno.lourenco


O modo de afectar o conteúdo de o controlo ASP.NET Textbox, em que esteja definido o modo de texto, do input, como Password (TextMode = Password), deverá ser diferente do habitual:

 1: password.Text = "password";

Mas sim, deverá ser:

 1: password.Attributes.Add("value", "password");

Happy codding icon smile ASP.NET Textbox TextMode = Password

ASP.NET SqlMembershipProvider schema version error

Wednesday, March 19th, 2008
Autor: ricardo.fiel


While migrating a database from SQL Server 2005 to SQL Server 2000, a colleague was faced with this exception:

The ‘System.Web.Security.SqlMembershipProvider’ requires a database schema compatible with schema version ’1′. However, the current database schema is not compatible with this version. You may need to either install a compatible schema with aspnet_reqsql.exe (available in the framework installation directory), or upgrade the provider to a newer version.

He didn’t use aspnet_regsql on the target db. Instead, he generated schema create scripts from SQL Server Management Studio. I usually use RedGate SQL Compare and SQL Data Compare, which I believe to be priceless for database synchronization.

There are many probable causes for this. After browsing for solutions, here’s a summary of steps we took to solve it:

  1. If possible, use aspnet_regsql on the target db.
  2. Make sure the user specified in the connection string has EXECUTE permissions on aspnet_* stored procedures. Grant them if necessary.
  3. Restart the web application

Don’t forget step 3!


Better Tag Cloud