Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
After installing Microsoft.AspNet.FriendlyUrls to hide .aspx from URL, The website is showing 500 internal server error only on mobile devices, but it works fine on the desktop.


Code in RouteConfig.cs
C#
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Routing;
using Microsoft.AspNet.FriendlyUrls;

namespace ASP
{
    public static class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            var settings = new FriendlyUrlSettings();
            settings.AutoRedirectMode = RedirectMode.Permanent;
            routes.EnableFriendlyUrls(settings);
        }
    }
}


Code in Global.asax

ASP.NET
<%@ Application Language="C#" %>

<script runat="server">

    void Application_Start(object sender, EventArgs e) 
    {
        RouteConfig.RegisterRoutes(System.Web.Routing.RouteTable.Routes);
        // Code that runs on application startup

    }
    
    void Application_End(object sender, EventArgs e) 
    {
        //  Code that runs on application shutdown

    }
        
    void Application_Error(object sender, EventArgs e) 
    { 
        // Code that runs when an unhandled error occurs

    }

    void Session_Start(object sender, EventArgs e) 
    {
        // Code that runs when a new session is started

    }

    void Session_End(object sender, EventArgs e) 
    {
        // Code that runs when a session ends. 
        // Note: The Session_End event is raised only when the sessionstate mode
        // is set to InProc on the Web. config file. If session mode is set to StateServer 
        // or SQLServer, the event is not raised.

    }


What I have tried:

I cannot find the solution anywhere.
Posted
Comments
Pete O'Hanlon 12-Jan-24 1:32am    
Have you looked at the logs in the site to see what's happening internally? That would be the best place to start, when you are trying to diagnose an issue like this. There could be many, many reasons why this is happening (from missing header information, incorrect agents, through to authentication issues), and the logs should give you more of an idea about what's actually going on.

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