Question Closing a web form

dcd

New member
Joined
Nov 4, 2009
Messages
2
Programming Experience
5-10
I have a web application that is called through a url with a phone number as one of the parameters. In my app I do a lookup into a CRM database and if I find a match I do a redirect to a different url using the info returned in my lookup. Basically the redirect opens a CRM account form using the guid I grabbed in my lookup. The problem is that if I don't find a match on the phone number I don't want to do anything, just close the app. I have not found a way to do this as yet and currently I display a form saying that the app could not find a match on that phone number.

Does anyone know a way to close the app before the form actually displays or is there another way in vb.net to handle a situation like this.

Thanks,

DCD
 
In your code behind add a JavaScript using the ClientScript namespace and add the onload attribute that will call the JS you've added to the return page. That'll close the browser window/tab next time the page is shown
 
In such scenarios, you can do a Page.ClientScript.RegisterStartupScript and emit window.close javascript code which will close the window.

The code will be something like

Page.ClientScript.RegisterStartupScript.(Me.GetType(), "PageCloseScript", "window.close();", True)
 
Back
Top