Url routing not working after deployment in ASP.Net

on Jul 22, 2020 11:22 PM

I have this simple url route example and it works fine on local machine. However, the url route doesn't work when I host it. Button click doesn't do anything. Thanks in advance.

Imports System.Web.Optimization
Imports System.Web.Routing

Public Class Global_asax
Inherits HttpApplication

Sub Application_Start(sender As Object, e As EventArgs)
' Fires when the application is started

End Sub

Public Shared Sub RegisterRoutes(routes As RouteCollection)
routes.MapPageRoute("Home", "Index", "~/Default.aspx")
routes.MapPageRoute("About", "About", "~/About.aspx")
routes.MapPageRoute("Hello", "WebForm1", "~/WebForm1.aspx")
End Sub
End Class

In Default page I have this

<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.vb" Inherits="Test._Default" %>


Default page CodeBehind

Private Sub About_Click(sender As Object, e As EventArgs) Handles About.Click
Response.Redirect(GetRouteUrl("About", Nothing))

End Sub

Private Sub Hello_Click(sender As Object, e As EventArgs) Handles Hello.Click
Response.Redirect(GetRouteUrl("Hello", Nothing))

End Sub


Download FREE API for Word, Excel and PDF in ASP.Net: Download