Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am developing a blog Website in asp.net c# Webform(https://[DELETED].in).

I am using using System.Web.Routing & Microsoft.AspNet.FriendlyUrls for routing in webform;

Route.Config is as follows:

        var settings = new FriendlyUrlSettings();
        settings.AutoRedirectMode = RedirectMode.Permanent;
        routes.EnableFriendlyUrls(settings);
        routes.MapPageRoute("RouteForArticle", "{url}", "~/ViewEntry.aspx");
        routes.MapPageRoute("RouteForCat", "default/{Category}", "~/Default.aspx");

I have 2 Problems while hosting to production environment(Godaddy Shared Hosting),those are as follows :

1. parameter {url} is getting checked on every page instead of ViewEntery.aspx. Once {url} is not available then getting error on other pages i.e default page.

2. Url contains the server folder name (http://[DELETED].in/lzblogs_[DELETED].in/Wedding-Photography) Where as "lzblogs_[DELETED].in" is the folder name in which i have hosted the website.Final url should be like http://[DELETED].in/Wedding-Photography
Please suggest the solution.


What I have tried:

1. Adding Foldername to page name i.e from
~/lzblogs_[DELETED].in/ViewEntry.aspx

2. Commented
routes.MapPageRoute("RouteForCat", "default/{Category}", "~/Default.aspx");
and using query string to pass parameter to other pages. :(
3. I have tried almost everything within my capacity + Stackoverflow too. But No luck yet.
Posted
Updated 31-Jan-22 2:35am
v3

1 solution

I would suggest to use URL Rewrite in IIS, this can be done in the web.config
XML
<rewrite>
  <rules>
    <rule name="Remove Virtual Directory">
      <match url=".*" />
      <action type="Rewrite" url="{R:0}" />
    </rule>
  </rules>
</rewrite>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900