This topic is locked

Trying to trigger an event

7/12/2016 5:27:17 PM
ASPRunner.NET General questions
R
raymueller authorDevClub member

I have been trying to code a test solution to react to an event.
I created a very simple application (4 fields) and which created the

fields and CRUD to allow a user to view, add and edit record.
I added a simple database (email, password and user name) and

enabled database security - works just fine.
In the course of my working, I have been trying to get the After Login

Success event to fire or at least display an indication that an

event occurred.
Under the Login page, I added code under the After successful login

to display a JavaScript popup. My assumption is that when I successfully

login, that the event will trigger thusly displaying an alert dialog

box.
The code is ultrasimple
public XVar AfterSuccessfulLogin(dynamic username, dynamic password, dynamic data, dynamic pageObject)

{

MVCFunctions.EchoToOutput("<script>alert('Triggered');</script>");

}
The applications works however the alert dialog window is not displayed.
What can I be missing?
Thank you

Ray

Sergey Kornilov admin 7/12/2016

After successful login you are redirected to another page. So whatever you output in this event won't be shown. If you do need to display something - save your message to session variable on display it on the page where user is redirected after the login. You can do that, for instance, using a code snippet.

R
raymueller authorDevClub member 7/12/2016

Sergey
Thank you. I will give that a try.
Thank you again

Ray



After successful login you are redirected to another page. So whatever you output in this event won't be shown. If you do need to display something - save your message to session variable on display it on the page where user is redirected after the login. You can do that, for instance, using a code snippet.

Pete K 7/15/2016

Not related to your question Ray, but thanks for sharing your code for triggering a JS alert from server side. That is very helpful for troubleshooting. Trivial I know, but it never occurred to me before.