I am using ASP.NET with say, OpenLink.aspx and OpenLink.aspx.cs
I have a link in the page that should, when clicked, open a new tab on a different website (that shares our user base exactly). This page must first be logged in to.
I first tried doing this in OpenLink.aspx:
<a href="tgt.com/page" id="mylink" runat="server" target="_Blank">Go to Page</a>
The problem with this is that one must first login to access tgt.com, so this only works if they have already been on this site recently on the same browser. But I do have all the necessary info to login them in. So I then tried in OpenLink.aspx.cs:
protected void mylink_Click(object sender, EventArgs e)
{
string loginScript = "<script>window.open('tgt.com/login.aspx?email=......','mynewtab');</script>"
ClientScript.RegisterStartupScript(typeof(Page), "openWindow", loginScript);
string destScript = "<script>window.open('tgt.com/page','mynewtab');</script>"
ClientScript.RegisterStartupScript(typeof(Page), "openWindow", destScript);
}
In this case only the top one runs. I would try to just wait some time between the commands, but it doesn't seem like RegisterStartupScript executes the script immediately (my knowledge of that stuff isn't great), and anyway when I tried Thread.Sleep(3000), I got all of these "asynchronous operations are not allowed" errors.
Any Ideas