Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Postback issue with ASP .NET 2.0

Reply
Thread Tools

Postback issue with ASP .NET 2.0

 
 
James Thomas
Guest
Posts: n/a
 
      06-22-2006
I have an issue with the login process on my site since the upgrade to
ASP .NET 2.0 (from 1.1).

I have the standard textbox and button for logging and my own custom
login process. I'd like to continue using this as it works fine
(usually) and meets my needs exactly.

Anyway, When a user logs in successfully, everything is fine. When an
invalid user name and password is entered, I inform the user of this
using a javascript alert(). This also works fine. However, on the VERY
NEXT click .

Alert is a simple function that sends a javascript alert using
ClientScript.RegisterStartupScript() to display an alert on the client.
I am fairly certain that the problem isn't with the login code as the
alert is being sent correctly to the client.

The only way to get this working is to cause a redirect to happen,
redirecting the page to itself.

Any ideas?

Thanks,

James

Here's my code:

protected void btnLogin_Click(object sender, EventArgs e)
{
Succeed.Login login = new X.Login(txtLogin.Text, txtPassword.Text);

string redirect = "";

switch (login.go())
{
case X.Login.Status.Admin:
redirect = "xxx.aspx";
break;
case X.Login.Status.Expired:
Alert("Login expired. Please call xxx-xxx-xxxx to renew.");
return;
case X.Login.Status.GroupOwner:
redirect = "xxxx.aspx";
break;
case X.Login.Status.Invalid: // ** HERE **
Alert("Invalid login or password. Please try again.");
return;
default: // Success!
redirect = "xxx_Main.aspx";
break;
}

if (redirect.Length > 0)
{

if (State.Check("SSO") == false)
{
string script = "SetCloseParent(true); PopupSize('" + redirect +
"','xxx'," // URL
+ "'800px','600px');";
Script(script);
}
else
UI.Goto(redirect);
}
}
 
Reply With Quote
 
 
 
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      06-23-2006
Hi James,

Thank you for your post.

Based on my understanding, the question is:
1) You are registering some startup javascript to display a alert dialog
but it only shows up upon next postback.
Please correct me if I've misunderstood anything.

Since you didn't posted the function "Alert", so I wrote my "Alert"
function as follows:

private void Alert(string p)
{
ClientScript.RegisterStartupScript(GetType(), "alert",
"javascript:alert('" + p + "');", true);
}

And that function works correctly using a simple button's click event.

Is it possible it's related to the "login.go()" call? What's it doing?
Could you please post the code or describe it briefly?

If possible, could you please send me a repro project? Thanks.


Regards,
Walter Wang ((E-Mail Removed), remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
 
 
 
James Thomas
Guest
Posts: n/a
 
      06-23-2006
No actually - the problem is that the alert is display just fine on the
same postback. However, once it is sent, the client no longer responds
to any POST events - any button I click appears to do nothing.

The problem actually was in my login.go() method, though not directly.
I am using the new Theme structure of ASP .NET 2.0, and I load the
theme name (and therefore theme folder) from the database in the
Page_PreInit() method. The problem was that I was setting the LoginId
to -1 in the session and then trying to load the theme from the
database with a LoginId of -1 (which there wasn't) - this was causing
an error and my default error page was getting redirected to, which was
loading the theme from the database and causing another redirect - and
therefore gave the appearance of no response.

A simple removal of the Login Id being set to -1 when not needed
resolved my problem.

Thanks!

James

Walter Wang [MSFT] wrote:

> Hi James,
>
> Thank you for your post.
>
> Based on my understanding, the question is:
> 1) You are registering some startup javascript to display a alert
> dialog but it only shows up upon next postback.
> Please correct me if I've misunderstood anything.
>
> Since you didn't posted the function "Alert", so I wrote my "Alert"
> function as follows:
>
> private void Alert(string p)
> {
> ClientScript.RegisterStartupScript(GetType(), "alert",
> "javascript:alert('" + p + "');", true);
> }
>
> And that function works correctly using a simple button's click
> event.
>
> Is it possible it's related to the "login.go()" call? What's it
> doing? Could you please post the code or describe it briefly?
>
> If possible, could you please send me a repro project? Thanks.
>
>
> Regards,
> Walter Wang ((E-Mail Removed), remove 'online.')
> Microsoft Online Community Support
>
> ==================================================
> When responding to posts, please "Reply to Group" via your newsreader
> so that others may learn and benefit from your issue.
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.


 
Reply With Quote
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      06-24-2006
Hi James,

Thank you for your reply and the detailed additional feedback on how you
were successful in resolving this issue. This information has been added to
Microsoft's database. Your solution will benefit many other users, and we
really value having you as a Microsoft customer.

If you have any other questions or concerns, please do not hesitate to
contact us. It is always our pleasure to be of assistance.

Have a nice day!

Regards,
Walter Wang ((E-Mail Removed), remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.Net Multiple PostBack Issue =?Utf-8?B?VG9tIEFuZGVyc29u?= ASP .Net 7 05-10-2010 09:11 AM
Cross-Page PostBack, Master page, and GridView issue in ASP.Net 2.0 steve.craver@gmail.com ASP .Net 0 05-22-2006 10:07 PM
Can I raise a postback ? Session variable only visible after postback. Please help gce ASP .Net 2 05-08-2005 05:55 AM
Postback not being set to True on first postback =?Utf-8?B?Q2hhZA==?= ASP .Net 2 04-04-2005 06:17 PM
effecting postback without auto postback controls Psych971 ASP .Net 5 12-17-2004 08:53 PM



Advertisments