Hi all,
[I am sure it's a simple question to most of you :)]
I check whether session is alive in Page_Load.
If session is not alive then I want to navigate to another page, most
probably the login page.
But when a control, a button for example, is clicked, after Page_Load the
button's click event is also fired.
Since session is abandoned at this moment, any object references raise
"object reference not set" exception.
Since my application contains frames I do not use Server.Transfer or
Response.Redire ct. In stead, I use client side javascript code to navigate
to the login page in the "top" window.
What's the workaround of this situation?
thanks in advance,
AG 1 3124
You cannot stop event firing, it is biult into the page processing. You can
choose not handling or handling correctly (in your case).
For example, your problem could be the user click a button after a long
pause so that the session has been timed out. You simply:
private Button1_Click(. ...)
{
if (Session["MyObject"]==null)
{
Response.Redire ct("OtherPage.a spx");
return;
}
//Do regular buton-click handling
}
BTW, if you wnat to redirect user to a loggin page, why not using Form
authentication, which automatically handles loggin redirecting for you if
session is timed out.
"Ahmet Gunes" <gu******@hotma il.com> wrote in message
news:eU******** ******@TK2MSFTN GP10.phx.gbl... Hi all,
[I am sure it's a simple question to most of you :)]
I check whether session is alive in Page_Load. If session is not alive then I want to navigate to another page, most probably the login page. But when a control, a button for example, is clicked, after Page_Load the button's click event is also fired. Since session is abandoned at this moment, any object references raise "object reference not set" exception.
Since my application contains frames I do not use Server.Transfer or Response.Redire ct. In stead, I use client side javascript code to navigate to the login page in the "top" window.
What's the workaround of this situation?
thanks in advance,
AG This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John Smith Jr. |
last post by:
I am looking for some way to persist a table web control so when page_load
event comes up, i can display the table as it was. I tried using ViewState
with the rows collection but that didn't work to well as I got an error
trying to put rows collection in the viewstate.
My problem is this:
I load a table with rows and controls, then wire events, this is after
clearing the rows of the table initially in this function.
|
by: moondaddy |
last post by:
I have a user control being used instead of a frame page. when the user
clicks on a menu item I need to send the ID (integer value) of that menu as
a parameter in the postback of the user control which will be used to query
sql server to repopulate the datagrid in the user control.
I also wrapped the user control in a panel element so I could position it on
the page.
I'm clueless on how to get started with this.
|
by: Shourie |
last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle.
1) MainPage_load
2) User control1_Load
user clicks a dropdown in UC1
_________________________
1) MainPage_Load
2) User Control_1 Load
|
by: Earl Teigrob |
last post by:
PROBLEM:
When a user control is loaded into a PlaceHolder control more than once, the
events do not fire on the first click of a control on the dynamically loaded
user control. In other words, the first time the control is dynamically
loaded, everything works fine. After that, if the control is loaded again
from the page button event handler, the user controls events fail to fire on
the first click
NOTE: I (believe I) am rebuilding all...
|
by: Raed Sawalha |
last post by:
I am trying to sort a DataGrid in a user control that is programatically
loaded when a link button is clicked.
UC1 is loaded onto Page1.aspx after clicking a link button. No problem,
loads fine.
How do I call the following event on UC1 when the sort collumn of the data
grid is clicked?
Sub DataGrid1_SortCommand(ByVal s As Object, ByVal e As
DataGridSortCommandEventArgs)
| |
by: ~~~ .NET Ed ~~~ |
last post by:
I have a problem (don't we all?). I have a web form with multiple modules,
some of these modules have an ASP.NET (server run) button.
OK, now I have UserControlX which has one such button (say Login). In that
user control I defined both the Command and Click events for the button and
placed a break point on it (in addition to traces). This user control is
then included in the main form within the Form element/tags. Both the user
control...
|
by: Paal Berggreen |
last post by:
I am involved with development of a Portal solution using ASP.NET 2.0
and WebParts. The WebParts framework use the default personalization
providers, and the personalization data thus ends up in the aspnetdb
database (which we have placed on a proper SQL Server, not SQL Server
Express).
Everything works like a charm, with the following exception:
New users in the system have to press links or buttons twice upon their
first logon to...
|
by: chelsea |
last post by:
I am using a GridView control with a ButtonField and receiving 2 row command
events for each click of the button. Is there a configuration switch that I
can turn that will ensure I only receive one call to my handler? I'm using
the most basic wiring as it comes out of VS 2005.. Thanks in advance for your
help!
ex/
<%@ Page Language="C#" AutoEventWireup="false" CodeFile="Default2.aspx.cs"
Inherits="Default2" %>
|
by: mark4asp |
last post by:
How can I stop my Calendar control from firing the form validation
events?
I have a form containing several controls which have several
validation controls each.
One control is a TextBox where the date is entered. Connected to this
is an image button which launches a popup window containing a calendar
control. The selected value from the calendar is then fed back to the
TextBox.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |