Visual Basic.NET - error en pagina web asp y vb

 
Vista:
Imágen de perfil de ignacio Valdes
Val: 84
Ha mantenido su posición en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

error en pagina web asp y vb

Publicado por ignacio Valdes (43 intervenciones) el 24/05/2017 20:16:39
Colegas, monte aplicacion web form en aspx y vb en iis, el proyecto me corre bien en visual studio 2010, cuando lo monto en el sitio ya compilado, me corre bien al prinipio , en el momento que le doy clic al boton para que salve los datos del formulario aspx , me salta el siguiente error. busque en internet y hace referencia a que no debo usar msgbox del windows form en paginas web form y no la uso. Seguido del error muestro los procedimientos utilizados. Pido ayuda por favor, de su tiempo free.
---------------------------------
Server Error in '/' Application.

Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: Showing a modal dialog box or form when the
application is not running in UserInteractive mode is not a valid operation.

Specify the ServiceNotification or DefaultDesktopOnly style to display a
notification from a service application.]
System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text,

String caption, MessageBoxButtons buttons, MessageBoxIcon icon,
MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean
showHelp) +4552099
System.Windows.Forms.MessageBox.Show(String text, String caption,
MessageBoxButtons buttons, MessageBoxIcon icon) +52
_Datos.ButtonGuardar_Click(Object sender, EventArgs e) +1531
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)

+155
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.36373
---------------------
Aca los dos procedimentos.
-----------------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Protected Sub ButtonGuardar_Click(sender As Object, e As System.EventArgs) Handles ButtonGuardar.Click
 
	mensaje("SU SOLICITUD SERA ENVIADA POR CORREO AL RESPONSABLE DEL PRESUPUESTO. LE SERA NOTIFICADA SU APROBACION.")
 
	TextBoxAprobado.Text = cargo_director()
	'abro la conexion.
	Dim CADENA As String = "server=localhost; database=Pubs; user=root; password=gases09*"
	Try
		Dim CN As New MySqlConnection(CADENA)
		Dim QUERY As New MySqlCommand
		Dim RES As Integer
		CN.Open()
		'obtengo el ultimo id de la base de datos
		Dim adaptador = New MySqlDataAdapter("SELECT * FROM `pubs`.`datos` ORDER BY `No_de_registro` ASC", CN)
		Dim midataset = New DataSet()
		adaptador.Fill(midataset, "datos")
		Dim ultimo_registrado As Integer
		If midataset.Tables("datos").Rows.Count() - 1 >= 0 Then
			Dim i As Integer = midataset.Tables("datos").Rows.Count() - 1
			ultimo_registrado = midataset.Tables("datos").Rows(i).Item("No_de_registro")
		Else
			ultimo_registrado = 0
		End If
		'lo deposito en el texbox
		TextBoxRegistro.Text = ultimo_registrado + 1
		QUERY.CommandType = Data.CommandType.Text
		QUERY.CommandText = "INSERT INTO `pubs`.`datos` (`Correo`, `Proceso`, `No_de_registro`, `Fecha`, `Area`, `Nombre del Solicitante`, `Destino`, `Descripcion`, `Cantidad`, `Unidad de Medida`, `Fecha en la que se necesita`, `Responsable del Presupuesto`, `Aprobado por`, `aprobado1`, `aprobado2`) VALUES ('" & Session("correo") & "','" & TextBoxProceso.Text & "','" & Val(TextBoxRegistro.Text) & "','" & TextBoxFecha.Text & "','" & TextBoxArea.Text & "','" & TextBoxSolicitante.Text & "','" & TextBoxDestino.Text & "','" & TextBoxDescripcion.Text & "','" & TextBoxCantidad.Text & "','" & TextBoxUnidad.Text & "','" & TextBoxFecha2.Text & "','" & TextBoxResponsable.Text & "','" & TextBoxAprobado.Text & "', 'False', 'False')"
		QUERY.Connection = CN
		RES = QUERY.ExecuteNonQuery()
		CN.Close()
	Catch EX As Exception
		mensaje(EX.Message.ToString())
	End Try
	EnviarEmail(Session("correo_presupuesto"), "Notificación de solicitud de compra.", "Se ha realizado una Solicitud de Compra la cuál usted debe atender como Responsable de presupuesto. De Clic en el siguiente enlace para mostrar detalles. http://localhost:1523/solicitudes/detalles_solicitud.aspx?id=" & TextBoxRegistro.Text & "&vquien=aprovado1")
 
	Response.Redirect("login.aspx")
End Sub

===Este es el procedimiento que uso para emitir mensaje al usuario (que por cierto, me funciona en el proyecto, pero no en el sitio despues de compilado====

1
2
3
4
5
6
7
Sub mensaje(mensage As String)
Dim msg As String
	msg = "<script language='javascript'>"
	msg += "alert('" & mensage & "');"
	msg += "<" & "/script>"
	Response.Write(msg)
End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil
Val: 481
Bronce
Ha mantenido su posición en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

error en pagina web asp y vb

Publicado por Miguel (476 intervenciones) el 25/05/2017 12:30:38
Hola,
No noto el uso del 'MessageBox' en tu código pero haría falta revisar la función 'cargo_director' para verificar que allí tampoco lo uses.

Saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de ignacio Valdes
Val: 84
Ha mantenido su posición en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

error en pagina web asp y vb

Publicado por ignacio Valdes (43 intervenciones) el 25/05/2017 19:22:32
MessageBox no lo utilizo en ninguna parte del proyecto y en la funcion cargo_director lo que tengo es

Function cargo_director()
'abro la conexion.

Dim CADENA As String = "server=localhost; database=Pubs; user=root; password=gases09*"
Dim Vnombre As String
Try

Dim CN As New MySqlConnection(CADENA)
Dim QUERY As New MySqlCommand
Dim RES As Integer
CN.Open()

'obtengo el nombre del diretor y su correo
Dim adaptador = New MySqlDataAdapter("SELECT * FROM `pubs`.`director` LIMIT 1000", CN)

Dim midataset = New DataSet()
adaptador.Fill(midataset, "director")
CN.Close()

Vnombre = midataset.Tables("director").Rows(0).Item("nombre")
Return (Vnombre)
Catch EX As Exception
Response.Redirect("notificacion.aspx?texto=" + EX.Message.ToString())

End Try

End Function

incluso elimine la funcion mensaje sustituyendolo por una llamada a un ASPX (Response.Redirect("notificacion.aspx?texto=" + EX.Message.ToString())) y en el proyecto local me funciona a la perfeccion pero cuando lo llevo a sitio web y accedo a el me sigue dando el error cuando acepto, gracias por contestar, sigo investigando, si alguien tiene alguna sujerencia?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar