473,471 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

[HELP] Global.asax doen't execute OnBeginRequest

Yesterday I posted about Url-Rewriting. Now I have solved this kind of
problem but now I have troubles deploying on Win2003 my application.

I develop apps on VS 2005 and XP pro. To manage Url-Rewriting i insert
code in the OnBeginRequest method in Global.asax. It works fine on dev
machine but when I deploy on Win 2003 Server it doesn't work.

Everytime my app fire the OnBeginRequest I also write a log row in a
text file with requested Url. On Dev machine if I call test.aspx in log
file i find many rows one for each file enclosed in web page (the page
itself, css, images ...).

On Win 2003 server in log file I find only one row , the page itself.
No errors but also no url-rewritig.

Can you help me?

Thanks a lot.

Fransis
Feb 26 '08 #1
3 1621
I try to explain better:

I inserted this code in OnBeginRequest.
if (!System.IO.File.Exists(Request.PhysicalPath))
{
Context.RewritePath("~/test.aspx", false);
}
Then on a web page (default.aspx) i've a link to url "NotExistingFile.html".

When I enter the default.aspx the code inside OnBeginRequest is
executed. Instead, When I clik the link to NotExistingFile.html the code
is not executed.

This code works right on dev machine with (VS2005 and XP Pro) but not on
Win 2003 Server.

Can you help me?

Thanks

Fransis
Feb 26 '08 #2
If you change the link to NotExistingFile.aspx, then I would guess that it
works.

Basically, if you are trying to redirect a file that doesn't exist, then you
have to ensure that the (non-existant) file you are linking to is being
handled by .NET. In this case, .HTML is probably not being checked.

So, basically, if you want .html to be used by .NET, then you have to set
your mappings in IIS to cause .html to be handled.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"Fransis il Mulo" <fr*********@tiscali.itwrote in message
news:47***********************@reader3.news.tin.it ...
>I try to explain better:

I inserted this code in OnBeginRequest.
if (!System.IO.File.Exists(Request.PhysicalPath))
{
Context.RewritePath("~/test.aspx", false);
}
Then on a web page (default.aspx) i've a link to url
"NotExistingFile.html".

When I enter the default.aspx the code inside OnBeginRequest is executed.
Instead, When I clik the link to NotExistingFile.html the code is not
executed.

This code works right on dev machine with (VS2005 and XP Pro) but not on
Win 2003 Server.

Can you help me?

Thanks

Fransis

Feb 27 '08 #3
David ha scritto:
If you change the link to NotExistingFile.aspx, then I would guess that it
works.

Basically, if you are trying to redirect a file that doesn't exist, then you
have to ensure that the (non-existant) file you are linking to is being
handled by .NET. In this case, .HTML is probably not being checked.

So, basically, if you want .html to be used by .NET, then you have to set
your mappings in IIS to cause .html to be handled.
Perfect, now it works!

Thanks a lot
Feb 27 '08 #4

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

Similar topics

1
by: Juha Borenius | last post by:
I have a web site that requires some directories to be protected with password. Directories might contain any kind of files from aspx -pages to pdf -documents. Protected directories are not virtual...
9
by: tshad | last post by:
I have an example I copied from "programming asp.net" (o'reilly) and can't seem to get the Sub (writefile) to execute. It displays all the response.write lines that are called directly, but not...
12
by: John M | last post by:
Hello, On Microsoft Visual Studio .NET 2003, I want to use some global elements, that can be used in each one of my pages. i.e I put a oleDBConnection on global.asax.vb How can I use it...
7
by: Ankit Aneja | last post by:
I put the code for url rewrite in my Application_BeginRequest on global.ascx some .aspx pages are in root ,some in folder named admin and some in folder named user aspx pages which are in user...
5
by: ad | last post by:
The Global.asax is code-inside with default. How to change Global.asax to code-behind?
0
by: hynek.cihlar | last post by:
A strange behaviour thatI found in ASP.NET 2.0. I am trying to issue a callback request (handled by ICallbackEventHandler and RaiseCallbackEvent) and a regular GET request in the client browser...
11
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...
7
by: Christian Blackburn | last post by:
Hi Gang, Let me start by saying I'm using Visual Web Developer 2005 and ASP.net 2.0. Is there something I have to do to get my Global.asax fire when my application loads. If I set a breakpoint...
3
by: Peter Larsen [CPH] | last post by:
Hi, I have a problem where the code in Global.asax.cs runs before the unittests (on test of course). In the global file, i load some data from a Oracle table and save it in...
0
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,...
0
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,...
0
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...
1
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...
0
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,...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.