Results 1 to 4 of 4
  1. #1
    ABW Ambassador PatrickAllmond's Avatar
    Join Date
    September 20th, 2005
    Location
    OKC
    Posts
    1,219
    Question about URLencoding to my fellow ASP.NET programmers
    I am working in ASP.NET/C# to build a google sitemap from my product info. I am trying to get my product URLs encodeded correctly to imbed in a google sitemap XML file OK so Google can crawl correctly.

    ASP.NET has two methods for this and neither seem to give me exactly what I need.

    HTTPUtility.Urlencode() produces URLs like:
    PHP Code:
    <loc>http%3a%2f%2fwww.mydomain.com%2fpr-454395466-Hogue+Merlot+Columbia+Valley+Reserve.aspx</loc
    Which look great in XML. But of course if I copy and paste that into a browser it does not work well. Is that an issue?

    Server.HTMLencode() produces URLs like (different product):
    PHP Code:
    <loc>http://www.mydomain.com/pr-454395653-Talbott Chardonnay "Sleepy Hollow".aspx</loc> 
    produces cleaner URLs but does not encode things like quotes. This also does not copy and paste well which makes me think that google will not like it.

    How have you solved this issue?
    ---
    This response was masterly crafted via the fingers of Patrick Allmond who believe you should StopDoingNothing starting today.
    ---
    Focus Consulting is where I roll | Follow @patrickallmond on Twitter
    Search Engine Marketing | Search Engine Optimization | Social Media | Online Video

  2. #2
    Member offerfind's Avatar
    Join Date
    January 18th, 2005
    Posts
    69
    Hmm... Personally, I would suggest not using "'s in your URL, and I would replace the spaces with - or _

    You could create function to replace any bad URL chars.

  3. #3
    Lite On The Do, Heavy On The Nuts Donuts's Avatar
    Join Date
    January 18th, 2005
    Location
    Winter Park, FL
    Posts
    6,930
    Offerfind is ON THE MONEY! You must ditch the " and spaces. Once done, you're xml sitemap issue will be solved, along with many others.

    ASP folks do dynamic page renaming (mod rewriting) using either "IIS Rewrite" or "ISAPI_Rewrite". They're both good, but I think the ISAPI one is better for several unimportant reasons. Pick one and go with it.

    ISAPI is here: http://www.isapirewrite.com/

  4. #4
    ABW Ambassador PatrickAllmond's Avatar
    Join Date
    September 20th, 2005
    Location
    OKC
    Posts
    1,219
    Thanks all. I solved this right after I posted it and should have posted back. Like he said I ended up writing my own routine to take care of it.

    I also ended up with a way to do the mod_rewrite functionality without any IIS or ISAPI modifications. It is all internal to ASP.NET and my code which I like.

    Thanks.
    ---
    This response was masterly crafted via the fingers of Patrick Allmond who believe you should StopDoingNothing starting today.
    ---
    Focus Consulting is where I roll | Follow @patrickallmond on Twitter
    Search Engine Marketing | Search Engine Optimization | Social Media | Online Video

  5. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Web Developer ASP / ASP.NET and PHP.
    By Murray Newlands in forum Job Postings
    Replies: 0
    Last Post: July 24th, 2007, 05:23 AM
  2. Poll: ASP, ASP.NET or PHP
    By PatrickAllmond in forum Programming / Datafeeds / Tools
    Replies: 9
    Last Post: October 5th, 2005, 09:38 AM
  3. Amazon ECS 4.0 & ASP.NET (VB.NET) QUESTION
    By stfarm45 in forum Programming / Datafeeds / Tools
    Replies: 0
    Last Post: March 2nd, 2005, 10:44 PM
  4. ASP.Net
    By Packy in forum Programming / Datafeeds / Tools
    Replies: 2
    Last Post: April 4th, 2004, 11:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •