Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 23rd, 2007, 09:50 AM
Registered User
 
Join Date: May 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yep, the application is like 20 aspx pages and they all work great with connections to Active Directory and SQL INSERTS, databinding etc., there's a lot going on that works fine. It's just that the code in global.asax doesn't execute. Super frustrating, and I'm sure it's something simple I'm missing.

If I put a bad line of code in global.asax it does error and show me the line that's erroring. So I have no idea.

 
Old May 23rd, 2007, 10:00 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Curious; if the Events are not firing, how is this line true:

If I put a bad line of code in global.asax it does error and show me the line that's erroring.

??

In any case, if the .asax file is in the Root of the web directory and the directory is setup as an application through IIS, I am not sure how to fix this. I did a quick search on Google and there were no serach results for problems with the Global.asax events not firing.

Imar or Peter may have a better solution but I do not.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old May 23rd, 2007, 10:13 AM
Registered User
 
Join Date: May 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It is so odd. Yes global.asax can error, but other than that I can't make it affect anything. No actions in any of my global.asax Subs do anything. Helpless!

Imar or Peter?

 
Old May 23rd, 2007, 10:19 AM
Registered User
 
Join Date: May 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Strange, I can find a ton of people on the Internet experiencing an issue with their global.asax code not working, but not one valid reply.

I should mention that this is not a compiled project (no code-behind pages), just aspx pages with inline code. No Visual Studio involved. Everything works great except for this global.asax issue, which is why I asked if there was something simple I needed to do to hook it up to the application. I don't think I'm missing anything, but nobody seems to know how to get my global.asax to affect anything.

 
Old May 23rd, 2007, 10:28 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Even if you are not using VS your app will be compiled by the runtime the first time your application is visted. (You will see the bin directory with a DLL in it that is your application)

Imar and Peter are 2 of the Forum Pros.

As I said, I am not sure. In my Session_OnStart event I wrote these lines of code:

Response.Write("<script language='javascript'>window.location.href='http://www.google.com';</scr" + "ipt>");
Response.Redirect("http://www.google.com");

both redirect to Google as expected. Very strange.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old May 23rd, 2007, 10:55 AM
Registered User
 
Join Date: May 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just figured it out.

In my global.asax script, all my subs were contained within the "Public Class Global". I didn't think of it earlier because it was created by Visual Studio initially.

I think the bonehead programmer who was here before my time set it up as a template so all new global.asax's have it that way. Anyway I took everything out of the Class and my code seems to work fine now. Your google redirect did not work before I did this, then then did work after.

WOOHOO

To anyone out there on the web wondering why your global.asax isn't firing, check if your SUBs are inside of "Public Class Global" and get them outta there!

 
Old May 23rd, 2007, 11:05 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Glad you got it working. A word of advice though, while you may not have particularly cared for the person who was in your position prior to you, you should refrain from "name calling". The reason for this is simple: you called him a bonehead, problem is, the Global.asax is setup like that for a reason in VS as it becomes part of the Application Namespace inside the DLL, this is how the app references the code.

Be humble. You will invariable come across programmers who posess skills far superior to your own and, on the flip side, programmers who possess skills that are inferior to your own. You can learn something from both of the aforementioned groups; even if its something trival you can learn SOMETHING for everyone but no one is going to want to help the guy that calls other programmers "boneheads".

Simply put, if you put 10 programmers in the same room and ask them to each write a program that does the same thing, you will get 10 completely different copies of source code; programmers think differently so, by and large, everything they do in their code they do it for a reason, that doesn't make them a bonehead! ;]

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Display web cam in web pages peace2007 ASP.NET 2.0 Basics 1 September 17th, 2007 01:07 PM
How to redirect a web page ludigova Beginning PHP 1 September 4th, 2007 02:54 PM
redirect some pages automatically Maxxim ASP.NET 2.0 Professional 7 July 4th, 2007 08:16 AM
Web pages constructing: I-mode(mobile) pages karib Dreamweaver (all versions) 3 June 6th, 2004 09:48 AM
Printing Web Pages gaghazoul VBScript 0 February 5th, 2004 02:26 PM





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