Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Manually Use UrlRewriterManually Use UrlRewriter
Previous
 
Next
New Post
4/1/2008 6:22 PM
 

We have a page that is a search engine friendly page if you link there from our site.  When you do, a cookie is written to remember you last visit.

The problem is that if you land on this page with out clicking on of our links first, the search engine friendly url is not reproduced.  How may I rewrite the URL on the fly to model the search engine friendly url we need?

Is this possible?  The page class has an Init and Prerender stage, but not BeginRequest where I understand the UrlRewriter to work.  I do not have to use the rewriter, per se, I just need to change the response url on the fly the the page is initialized or pre-rendered.

 

Thank you,

 
New Post
7/10/2008 3:10 PM
 

You can get the Friendly Url with: Globals.NavigateURL()
It is part of the DotNetNuke.Common namespace.

 
New Post
7/10/2008 11:20 PM
 

I recently implemented the poker league name (as per Ifinity's Friendly URL blog) in my poker league software and faced this issue. It needs to do a 301 redirect for all old links. Here is the code I use to handle it.

So

http://www.pokerdiy.com/Leagues/PokerLeague/tabid/514/LID/241/Default.aspx becomes http://www.pokerdiy.com/poker-league/lid/241/Rods-Sydney-Poker-League.aspx but if you request that first URL it needs to punt it on to the new URL.

        public void CheckFriendlyURLandDoRedirect(int itemID, string itemName)
        {
            //check the URL to make sure it is in the FriendlyURL format
            HttpContext context = HttpContext.Current;
            string originalUrl = context.Items["UrlRewrite:OriginalUrl"].ToString().ToLower();

            if (!originalUrl.ToLower().EndsWith(Utilities.formatTitle(itemName).ToLower()))
            {
                string rewrittenUrl = String.Empty;
                rewrittenUrl = GetLeagueDetailURL(pmb.TabId, itemID, itemName);
             }

                //only put out the reason if the debug header is passed in
                bool stDebug = Convert.ToBoolean(context.Request.Headers["_stdebug"]);
                if (stDebug)
                {
                    context.Response.AppendHeader("STX-Redirect-Reason", "Smart-Thinker League Redirect");
                }
                context.Response.Status = "301 Moved Permanently";
                context.Response.AddHeader("Location", rewrittenUrl);
            }
        }


Entrepreneur

PokerDIY Tournament Manager - PokerDIY Tournament Manager<
PokerDIY Game Finder - Mobile Apps powered by DNN
PokerDIY - Connecting Poker Players

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Manually Use UrlRewriterManually Use UrlRewriter


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out