Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. URL Rewriting

URL Rewriting

Scheduled Pinned Locked Moved ASP.NET
helpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jintal Patel
    wrote on last edited by
    #1

    hii i have change my url name according to my requirment using global file concept this is my function void Application_BeginRequest(Object sender, EventArgs e) { String strCurrentPath; String strCustomPath; String StrReferrer; if (Request.UrlReferrer != null) StrReferrer = Request.UrlReferrer.PathAndQuery.ToString(); else StrReferrer = ""; // for SubCategory strCurrentPath = Request.Path; strCurrentPath = strCurrentPath.ToLower().Replace("/RedTag/Client/".ToLower(), ""); if (strCurrentPath.StartsWith("subcategory.aspx")) { strCurrentPath = StrReferrer; strCurrentPath = strCurrentPath.ToLower().Replace("/RedTag/Client/".ToLower(), ""); } if (strCurrentPath.StartsWith("c-")) { string id = strCurrentPath.Split('-')[1].ToString(); strCustomPath = "category.aspx?catid=" + id.ToString(); Context.RewritePath(strCustomPath); } if (strCurrentPath.StartsWith("m-")) { string id = strCurrentPath.Split('-')[1].ToString(); strCustomPath = "subcategory.aspx?MFRID=" + id.ToString(); Context.RewritePath(strCustomPath); } if (strCurrentPath.StartsWith("s-")) { string id = strCurrentPath.Split('-')[1].ToString(); strCustomPath = "SubCategory.aspx?catid=" + id.ToString(); HttpContext.Current.RewritePath(strCustomPath); // Context.RewritePath(strCustomPath); } if (strCurrentPath.StartsWith("p-")) { string id = strCurrentPath.Split('-')[1].ToString(); strCustomPath = "ItemPage.aspx?ProductID=" + id.ToString(); Context.RewritePath(strCustomPath); } } now problem is that first time when my subcategory page load that time the url is like Client/s-1001-Data.aspx but when i do paging then my page is ispostback and my url change to SubCategory.aspx?catid=1001 means which is in my Context.RewritePath ..i want the same url name should maintain through out the page...

    Jintal Patel

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups