Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 6th, 2006, 11:18 PM
Authorized User
 
Join Date: Feb 2006
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default aspx page not loading!!!! Method called too soon

Why isn't my aspx page rendering before the process() method call? What is
happening is when I run my page in debug mode, my aspx page never renders, and it's jumping straight into my process() method when I run in debug mode in VS 2005, using the VS
built-in web engine.

What should happen is I start debug, my aspx page loads, I click on the hyperlink, and that initiates process() to run. It's not happening that way though, why?

See related article here (http://www.codeproject.com/aspnet/urlrewriter.asp) and then my code below :

My aspx page:


<%@ 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);
            }
        }



Reply With Quote
Reply


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
Master Page Method: Code-Behind for Content Page kwilliams ASP.NET 2.0 Professional 3 June 2nd, 2008 12:57 PM
wrapper class getWriter() method never called milspecs Apache Tomcat 0 January 26th, 2005 05:27 PM
Nested frames crash page when called on XP Umen Javascript 4 September 23rd, 2004 10:55 AM
How to pass variables from Aspx page to Asp Page jayaraj Classic ASP Basics 2 May 23rd, 2004 06:56 AM



All times are GMT -4. The time now is 11:58 PM.


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