Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 5th, 2004, 05:50 AM
Authorized User
Join Date: Apr 2004
Location: Gurgaon, Haryana, India.
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ranakdinesh
Default how to call Application Variable from global .asax

i am new to ASpx coding with C#.
i am created a login page which will lock the user account if he tries more then three times with wrong password. for that i made global.asax file as

 void Application_OnStart(Object sender ,EventArgs E)

Application["Hcount"] = 0;
     void Session_OnStart(Object sender ,EventArgs E)
Session["tries"] =0;
         // Session start-up code goes here

My Login Form Page Has the following Code genreating error that i cannot use comparison operators Application and Session Variables are objects the code with error is

if (Application["Hcount"] <= Session["tries"])

how i can use these variables in my code sothat they work smoothly as they work when same is written in VB .Net

dinesh Rana
dinesh Rana
  #2 (permalink)  
Old August 5th, 2004, 07:38 AM
Friend of Wrox
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts


Try HttpContext.Current.Application and HttpContext.Current.Session. Don't know if the objects are accessible where they are being created....

  #3 (permalink)  
Old August 6th, 2004, 06:01 AM
Friend of Wrox
Join Date: Jul 2004
Location: Tehran, , Iran.
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post

dinesh Rana
did you solved your problem I have a suggestion
void Session_OnStart(Object sender ,EventArgs E)
 Session["tries"] =0;
 while(!Session["tries"] =3)
  // Go to Register page
  if(user/pass==ok) //enter and enjoy(break;)
    Session["tries"] =Session["tries"]+1;


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to declare the global variable in global.asax? calyn_gately ASP.NET 3.5 Basics 0 August 6th, 2008 08:06 PM
what is global.asax? gaurav_jain2403 General .NET 1 February 3rd, 2006 02:40 PM
how to call application variable in global.asa mqnguyen Classic ASP Basics 4 July 28th, 2003 11:28 AM

All times are GMT -4. The time now is 05:00 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.