Ver Mensaje Individual
  #3 (permalink)  
Antiguo 05/08/2009, 04:17
lmalvarez
 
Fecha de Ingreso: julio-2009
Mensajes: 82
Antigüedad: 15 años, 6 meses
Puntos: 0
Respuesta: Enviar datos desde asp a c#

Gracias por la ayuda, pero sigue sin funcionar

Estoy siguiendo el siguiente ejemplo: ht tp://ww w.c-sharpcorner.com/UploadFile/mahesh/pr1211252005231855PM/pr12.aspx

Conseguí crear una librería en c#

Código c#:
Ver original
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Comun
  7. {
  8.     public class Comunicacion
  9.     {
  10.         private string mensaje;
  11.         public Comunicacion()
  12.         {
  13.             mensaje = "";
  14.         }
  15.  
  16.         public void enviaMensaje (string n)
  17.         {
  18.             mensaje = n;
  19.         }
  20.  
  21.         public string recibeMensaje()
  22.         {
  23.             return mensaje;
  24.         }
  25.     }
  26. }

que intento usar en esta página get2.aspx.cs (ya agregué la referencia)

Código aspx:
Ver original
  1. using System;
  2. using System.Collections;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Web;
  7. using System.Web.Security;
  8. using System.Web.UI;
  9. using System.Web.UI.HtmlControls;
  10. using System.Web.UI.WebControls;
  11. using System.Web.UI.WebControls.WebParts;
  12. using System.Xml.Linq;
  13. using Comun;
  14.  
  15. public partial class get2 : System.Web.UI.Page
  16. {
  17.     protected void Page_Load(object sender, EventArgs e)
  18.     {
  19.        
  20.     }
  21.     Comunicacion c = new Comunicacion();
  22.     c.enviaMensaje("hola");
  23.    
  24. }

pero me da el siguiente error:

Error 1 El token '(' no es válido en una clase, estructura o declaración de miembro de interfaz Linea 22

Alguna sugerencia?