sujets de discussions
Les posts du forum | |
---|---|
msn securité concours sale bete 31-03 20/03/2006 13:54:54 par Anonymous
Le bug du mois de mars Proposé par Pierre Lagarde BadQuotes.aspx <%@ Page language="c#" Codebehind="BadQuotes.aspx.cs" AutoEventWireup="false" Inherits="Inject.BadQuotes" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> ... </HEAD> <body> <asp:Label id="Quote" runat="server"></asp:Label> <asp:Label id="Author" runat="server"></asp:Label> </body> </HTML> BadQuotes.aspx.cs private void Page_Load(object sender, System.EventArgs e) { string id = Request["ID"]; if (id != null && id != String.Empty) { SqlConnection connection = new SqlConnection ("..."); try { connection.Open (); SqlCommand command = new SqlCommand ("SELECT quotation, author FROM quotations WHERE id=" + id, connection); SqlDataReader reader = command.ExecuteReader (); if (reader.Read ()) { Quote.Text = reader["Quotation"].ToString (); Author.Text = reader["Author"].ToString (); } } finally { connection.Close (); } } } Votre réponse * Il n'y a pas d'erreur dans le code Ne pas utiliser « ID » comme variable dans la chaine de connexion Vérifier que la variable ID est bien un entier avant de l'envoyer dans le requête SQL. |
|