473,382 Members | 1,615 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Postback issue with ASP .NET 2.0

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);
}
}
Jun 22 '06 #1
3 1299
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 (wa****@online.microsoft.com, 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.

Jun 23 '06 #2
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 (wa****@online.microsoft.com, 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.


Jun 23 '06 #3
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 (wa****@online.microsoft.com, 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.

Jun 24 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rhys | last post by:
I have a page which has an IFrame on it. The src of the IFrame is a page with a datagrid on it. The Datagrid has bound template columns. The columns of the datagrid pass the bound data value of...
7
by: Anand | last post by:
Hi All, The postback on my desktop stopped working. I am trying to run the webapplication locally on my desktop and the Postback on my home page won't trigger on any of my dropdown selections. The...
5
by: Tom Anderson | last post by:
I am currently having an issue with an ASP.Net 1.1 Web page that does the following remotely but not locally. Click on a control Check for postback, if postback, handle the event, otherwise...
3
by: teo | last post by:
Mozilla error on postback and validation ----------- A Button causes a Listbox to desappear. If no item has been selected on the Listbox, all is OK. If one or more items are selected,
2
by: =?Utf-8?B?SlA=?= | last post by:
Hi all. I'm having a problem with a postback issue and I think it's cache related. Here's my setup: I have a web site that has a signup section. This has simple things like name, age, birth...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.