views:

372

answers:

0

Hi All. ASP.Net 2.0

The scenario: I have a gridview with a template column with a custom rowcommand image button.

In short, the rowcommand fires some code behind which inserts a row into a SQL table with some unique values, then does a RegisterStartupScript which does a window.open. The page in the window.open logs a user in using the unique values that were saved in the SQL table and which were passed to the page in the querystring.

So in effect, this allows an Admin to log in as a user for this particular site without knowing their credentials. Technically I could just open a hyperlink, but this wouldn't be secure as the URL could be copied. With my method, once the page in the window.open page logs the user in, those unique values are deleted from SQL, so even if a user could copy the URL, it won't automatically log the user in.

The Problem: All of this works fine, except when the page with the gridview is refreshed after the rowcommand takes place, or if a user navigates away from that page and goes back. At that point, the rowcommand is called again, thus opening another new window.

What I need: So what I need to do is to be able to tell if the RowCommand was a refresh, or if it was the original click.

Any way to tell? TIA.

Larrybud

related questions