Msgbox to asp client?

  • Thread starter Thread starter Betina Andersen
  • Start date Start date
B

Betina Andersen

I have inherited a VB.NET dll that I am using from common asp.

My problem is to get the messages from the dll to the Ie client, I can see the messages in the Eventlog on the IIS server so I know they are there, but how do I get them to show in IE?

The original code was:
MsgBox("Kunne ikke finde databasenavn udfra den angivne DSN: " & DSN)
I tried to change that to:

Result = MessageBox.Show("Kunne ikke finde databasenavn udfra den angivne DSN: " & DSN, "Fejl", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly, False)

But they still dont show up on the client, so how do I do that?



Thanks

Betina
 
Keep in mind that the DLL runs server side so the message box is "shown"
server side (actually written in the log as it runs in a non interactive
context).

To show a message client side you have to send it to the browser in the
response (either as plain HTML or as a client side script that display this
in a message box).
The DLL could raise an exception to signal it has a problem.

In this particular case (looks like a technical error message), my personal
preference is rather to display a generic message to the user and to warn
the support team (after all the user won't be able to do anything else than
calling the support team if the DSN is not defined).

--
Patrice

"Betina Andersen" <[email protected]> a écrit dans le message de (e-mail address removed)...
I have inherited a VB.NET dll that I am using from common asp.

My problem is to get the messages from the dll to the Ie client, I can see
the messages in the Eventlog on the IIS server so I know they are there, but
how do I get them to show in IE?

The original code was:
MsgBox("Kunne ikke finde databasenavn udfra den angivne DSN: " & DSN)
I tried to change that to:

Result = MessageBox.Show("Kunne ikke finde databasenavn udfra den angivne
DSN: " & DSN, "Fejl", MessageBoxButtons.OK, MessageBoxIcon.Error,
MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly,
False)

But they still dont show up on the client, so how do I do that?



Thanks

Betina
 
In order to use the same code for winforms and webforms one must not
use directly controls (labels, progressbars, textboxes) or msgboxes.

You can define an abract messenger which issue messages (ex: statusmsg,
errormsg, logmsg, etc ).
Depending on the context (winforms/webforms) you will bind the events
(or delegates) of the messenger to controls (winforms) or
to some kind of web output (response, labels on web forms, etc.) ...

I find very convenient this kind of mechanism, as it allows to use the
same code for winforms or webforms.
It separates clearly the program logic from the GUIs.

-tom

Betina Andersen ha scritto:
 
So will I have to send the Response Object to my DLL and return it on error,
is that what you are saying?

Regards Betina
 
I do not use controls in my DLL, the idea with a messenger sounds
interestering, but my problem is that I am not very good in .NET, so can you
supply an example?

Regards Betina
 
I did send Response to my sub - then I used

Response.Write "Some message"
Response.Flush

But I cannot seem to get anything through to my client (IE) - what do I do
wrong?

Regard Betina
 
Betina,

The most easiest way for this is to create some labels on a panel that you
hide when don't need it.

One of the labels is your messagetext.

Cor
 
But how can I add a panel when I do not have a userinterface in the .NET
dll?

Regards Betina
 
What is that Net.dll

The system.net?

Cor

Betina Andersen said:
But how can I add a panel when I do not have a userinterface in the .NET
dll?

Regards Betina
 
I have a DLL written in VB:NET that DLL am I using from pure asp, the VB:NET
DLL consists of a lot og subs and functions which I call from my asp page.

Regards Betina
 
Betina,

Than it is obvious that you cannot use it to let it direct reach a webpage,
which it does not even know.

You can of course throw an error and let that be catched when you are
calling your DLL in a try and catch block. Than you can show the error in
the way I wrote.

http://msdn2.microsoft.com/en-us/library/ty79csek.aspx

I hope this helps,

Cor
 
Back
Top