Posts Tagged ‘ASP.NET’

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 :)

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 :)

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!

The ADO guy on ADO.NET Data Services

Tuesday, January 29th, 2008
Autor: ricardo.fiel


Scott Hanselman just published his 97th podcast, titled ADO.NET “Astoria” Data Services with Shawn Wildermuth. It’s a great listen. Shawn Wildermuth is the author of the highly acclaimed book Pragmatic ADO.NET.

Some of the highlights of the show are:

  • Why “Astoria” does not expose your database to the web
  • How Linq fits in the picture
  • The fear of SQL in URIs
  • A Silverlight client for “Astoria”

I was talking about “Astoria” with Marco the other day, and he correctly pointed that it doesn’t support SPARQL, which is now a W3C standard query language for RDF. As stated in this post on the “Astoria” Team Blog,

“What happened with RDF?

The May 2007 CTP also included support for RDF. While we got positive comments about the fact we supported it, we didn’t see any early user actually using it and we haven’t seen a particular popular scenario where RDF was a must-have. So we are thinking that we may not include RDF as a format in the first release of Astoria, and focus on the other 3 formats (which are already a bunch from the development/testing perspective).

My personal take is that while I understand how RDF fits in the picture of the semantic web and related tools, the semantic web goes well beyond a particular format. The point is to have well-defined, derivable semantics from services. I believe that Astoria does this independently of the format being used. That, combined with the fact that we didn’t see a strong demand for it, put RDF lower in our priority lists for formats. “

So, maybe it won’t happen in the first release, but the “Astoria” team is planning to support RDF. The question is, will they support SPARQL as well?


Better Tag Cloud