I am trying to rewrite my URLs when I make a search. But I can't even get the segments out of my URL, or maybe there are no segments but then I dont knwo how to change it.
How I try to get segments in Find.aspx
pageload:
IList <string> segments = Request.GetFriendlyUrlSegments();
for (int i = 0; i < segments.Count; i++)
{
Label1.Text += "- " + segments[i] + " -";
}
This is just to test if it even find 1 segment, which it does not.
I have also tried setting in it my RouteConfig like this:
public static void RegisterRoutes(RouteCollection routes)
{
var settings = new FriendlyUrlSettings();
settings.AutoRedirectMode = RedirectMode.Permanent;
routes.EnableFriendlyUrls(settings);
routes.MapPageRoute("", "Find", "~/Find.aspx");
routes.MapPageRoute("Find", "Find/{Result}", "~/Find.aspx");
}
I want to change the URL from this:
www.site.com/Find?Result=Test
To this:
www.site.com/Find/Test
or
www.site.com/Test
I "call" the link like this Response.redirect("~/Find.aspx?Result=" + searchString)
I am also wondering if Localhost:xxxxx/Default
Means that when I eventually buy a domain my startpage will look like www.sitename.com/Default
? If so how can I reroute that to be just www.sitename.com
?
Basically just want to make my site more SEO.