Reputation: 2647
I have a trouble, which I didn't get earlier with the ASP.NET
. I can't redirect to the some location with the method Response.Redirect()
I've read another topics and may tell you, what exactly I have tried:
Response.Redirect()
in try/catch
block, which may cause an ThreadAbortException
( but if you try to ignore this exception - you must be redirected, even in this case I can't redirect )Boolean
values , where using them as a flag at the end of Page_Load()
method to make a redirectionlocation
property, but ASP.NET ignores it... As I see I could call any function in JS and it will be ignoredfalse
the value of the second parameter of method Response.Redirect()
I shall paste ONLY
one of the variants, because as I wrote upper I tried different ways, but no success.
Code: http://ideone.com/Y8Fwpt
Redirect on 58th
line doesn't work even there is a handler for the ThreadAbortException
. Calling JS-scenario on 62nd
line - ignores too.
Even if I remove try/catch block
- nothing will change.
Please, help me to fix this issue!
Upvotes: 1
Views: 1272
Reputation: 21239
I could make the redirect work if I removed the onclick()
you have on the login form - I think your query string isn't coming across correctly, so you wind up just doing a quick page refresh. So, I would make two suggestions:
One, remove all the script & Ajax stuff you're trying to do, and get it working with normal postbacks first - then you can go back and try the async stuff.
Two, I wouldn't mess with creating your own cookies at this point - the MySQLConnector library has Membership
and Role
providers you can use that are built to connect to MySQL databases.
In a nutshell, the idiom I hold near and dear when I'm developing is "do the simplest thing that works," which in this case is just "classic" ASP.NET postbacks...
HTH.
Upvotes: 1