473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

aspx page never loads because method call in global.asax beats it.

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"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>URL Rewriter Test Page</title>
</head>
<body>
<asp:HyperLink ID="link1" NavigateUrl="/recipes/4/detail.aspx"
runat="server">/recipes/4/detail.aspx</asp:HyperLink>

</body>
</html>
My global.asax:
void Application_BeginRequest(object sender, EventArgs e)
{
MyNamespace.Web.URLRewriter.Process();
}
...rest of global.asax...

My .cs page:
namespace MyNamespace.Web
{
public class URLRewriter : IConfigurationSectionHandler
{
protected XmlNode _oRules;

protected URLRewriter(){}
private string recipeID;

public static void Process()
{
URLRewriter oRewriter =
(URLRewriter)ConfigurationSettings.GetConfig("syst em.web/urlrewrites");

string rewrittenURL =
oRewriter.GetRewrittenURL(HttpContext.Current.Requ est.Path);

if (rewrittenURL.Length 0)
{
//Rewrite the path using the rewritten URL
HttpContext.Current.RewritePath(rewrittenURL);
}
}
--
dba123
Aug 6 '06 #1
0 1142

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

Similar topics

4
by: Jim Douglas | last post by:
Ok, I'm must be an dummy, there are tons of examples which none of which I can get to work! I want to setup and refresh about (10) different cache items. Most examples show this type of work being...
6
by: Daniel Rimmelzwaan | last post by:
I want to send a biztalk document to an aspx page, and I need to see some sample code, because I just can't make it work. I have a port with transport type HTTP, pointing to my aspx page, something...
2
by: Daniel Rimmelzwaan | last post by:
I receive the error below when I try to access my aspx page in a browser. I created the aspx page on my laptop (but the solution resides on a server) with VS.NET and it builds correctly on the...
6
by: John Lau | last post by:
Hi, I am looking at the MS KB Article 306355: HOW TO: Create Custom Error Reporting Pages in ASP.NET by Using Visual C# .NET This article describes how to redirect errors to a custom html...
4
by: Bill | last post by:
Despite our best efforts occasionally in an aspx file, something like <%=x%> where x is not defined sqeaks by and I get the ugly asp error message. I want to be able to identify this particular...
8
by: Thomas Coleman | last post by:
Ok, I've obviously discovered that Global.aspx has been completely changed in ..NET 2.0. However, I haven't figured out how to declare a constant that's available to any page in my application...
27
by: Javier Martinez | last post by:
Hi I have asp application in a machine with a virtual directory referring a shared directory in another machine When I try to load any aspx page of my portal I get the following error: ...
2
by: simon | last post by:
hello, what i'm looking to do is store the path of the app on a the server for reuse in the site. my thoughts so far are... -make a key in the web.config file -retrieve the value in globals.asax...
0
by: Carl Gilbert | last post by:
Hi I have recently got the ASP.NET 2.0 Clubsite Starter Kit up and running on my 1&1 web space. Recently I have started getting lots of exceptions and white pages. I have put some code in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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...
0
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
tracyyun
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...
0
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...

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.