473,773 Members | 2,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Global.asax and CodeFile

How do I specify the CodeFile for my Global.asax file ?

According to the documentation I can use the CodeFile attribute with
Application, however when I try to use this I get an error saying that it
not a valid attribute.

<%@ Application Language="C#" Inherits="SQLVi ew.Global"
CodeFile="Globa l.asax.cs"%>

--
Michael Tissington
http://www.oaklodge.com
http://www.tabtag.com
Dec 2 '05 #1
2 2286
Hi Micheal,

We have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

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

Dec 3 '05 #2
Hi Michael,

Welcome.
As for the "not a valid attribute." error, are you getting it in VS2005
designer at design-time rathenr than runtime? As for the ASP.NET 2.0 's
Application Global file, we're recommended not to use codebehind models
since we can direclty put code in asax file, like:
===============
<%@ Application Language="C#" %>
<script runat="server">

void Application_Sta rt(object sender, EventArgs e)
{
// Code that runs on application startup

}

............... ............... ...
</script>
=============== ==

So no code behind file needed. Also, when we upgrade an existing asp.net
1.x project to 2.0, the VS2005 IDE will move the codebehind into App_Code
dir and we only reference that class by "Inherits" attribute in asax file
like;

============
<%@ Application Inherits="UCTes tWeb.Global" Language="C#" %>

=========
In addition, if you do want to use separate codeFile for Global.asax, it is
still possile, just clear the Global.asax file's content and add both the
correct "Inherits" and "CodeFile" attribute's value, like:

<%@ Application Language="C#" Inherits="UCTes tWeb.Global"
CodeFile="Globa l.asax.cs"%>

The Global.asax.cs file is like:

=============
namespace UCTestWeb
{
public partial class Global : System.Web.Http Application
{
............... .
It can run correctly at runtime no matter whether the IDE will prompt some
error or not....

Thanks,
Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "Michael Tissington" <mt*********@ne wsgroups.nospam >
| Subject: Global.asax and CodeFile
| Date: Fri, 2 Dec 2005 11:55:50 -0800
| Lines: 15
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <u2************ *@TK2MSFTNGP10. phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: 65.249.55.7
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP10.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3624 06
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| How do I specify the CodeFile for my Global.asax file ?
|
| According to the documentation I can use the CodeFile attribute with
| Application, however when I try to use this I get an error saying that it
| not a valid attribute.
|
| <%@ Application Language="C#" Inherits="SQLVi ew.Global"
| CodeFile="Globa l.asax.cs"%>
|
| --
| Michael Tissington
| http://www.oaklodge.com
| http://www.tabtag.com
|
|
|

Dec 5 '05 #3

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

Similar topics

22
3799
by: fd123456 | last post by:
Hi Tom ! Sorry about the messy quoting, Google is playing tricks on me at the moment. > Global.asax is where you normally have the Global Application > and Session variables and code to manipulate them. It starts > and ends with <script></script> tags. > > Yours looks like a compiled version of it.
5
15151
by: ad | last post by:
The Global.asax is code-inside with default. How to change Global.asax to code-behind?
0
942
by: Averell | last post by:
Hi, When an user tries to update a record in a gridview with a duplicate value, there comes an error like: "The changes you requested to the table were not successful because they would create duplicate values in the index etc ..." I tried to solve that with the errorPage like this: <%@ Page Language="VB" CodeFile="mult.aspx.vb" Inherits="mult" errorPage="err2.html" %>
11
8377
by: Ron | last post by:
I have a web project compiled with the new "Web Deployment Projects" plugin for VS2005. I'm deploying the web project to one assembly and with updateable option set to ON. When I'm running the generated code on a W2K3 server the application_start and any other event on the global.asax file won't fire. I added tracing and logging to make sure and I can see the code is just not execution. When running the same exact (deployed etc.) code on...
0
1160
by: dba123 | last post by:
Why isn't my aspx page rendering before the process() method call? What is happening is my aspx page never renders, and the debug is jumping straight into my process() method when I run in debug mode in VS 2005, usign the VS built-in web engine. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestURLRewriter.aspx.cs" Inherits="TestURLRewriter" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
4
5192
by: Larry Epn | last post by:
Simple question: I have a c# asp.net project that was given to me. It has the c# code within the <scriptsection of the global.asax file. I would rather have it in separate files; e.g., global.asax.cs; So, I deleted the existing global.asax file (there was nothing important in it yet), and went to add a new one through VS2005. I chose the "Global Application Class" (Global.asax) item from the list of new items. The "Place code in...
4
7499
by: WT | last post by:
Hello, Using VS2005, when I open the global.asax file, the editor underlines in blue all the line with a tooltip saying 'Syntaxe error '. <%@ Application Language="C#" Inherits="MyApp.Core.Global" Codefile="Global.asax.cs" %> But everything is running OK, the site is under a web application project.
8
13207
by: Rob T | last post by:
When I was using VS2003, I was able to compile my asp.net project locally on my machine and copy it to the production server and it would run just fine. I've now converted to VS2005. The project compiles & runs fine locally, but when I copy to the production machine, I get this error: Parser Error Message: Could not load type 'Global'. Source Error: Line 1: <%@ Application Codebehind="Global.asax.vb" Inherits="Global" %> Source...
15
2574
by: =?Utf-8?B?UGF0Qg==?= | last post by:
Just starting to move to ASP.NET 2.0 and having trouble with the Global.asax code file. In 1.1 I could have a code behind file for the global.asax file. This allow for shared variables of the Global class. Note: I use these shared variables for read only values that are set at application start. It would appear the 2.0 doesn't like you to use shared variables in the global class. How do I convert my 1.1 applications to 2.0 without...
0
9621
marktang
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...
0
9454
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,...
0
10264
Oralloy
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...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10039
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,...
0
8937
agi2029
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...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6717
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();...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.