Question

I added FriendlyUrls package via NuGet to my asp.net web pages project.

When I debug the solution it returns error that ASP.ViewSwitcher in ViewSwitcher.ascx could not load.

I did not find anything on the internet about this issue.

Could anybody please help me, how to fix this?

enter image description here

Était-ce utile?

La solution

change

<%@ Master Language="C#" AutoEventWireup="true" 
  CodeBehind="Site.Mobile.master.cs" Inherits="ASP.Site_Mobile" %>

to

<%@ Master Language="C#" AutoEventWireup="true" 
  CodeFile="Site.Mobile.master.cs" Inherits="ASP.Site_Mobile" %>

(Edit) That is the case if you are working on a website as oppose to a web application.

Autres conseils

I faced the same problem. Thanks to user3260977. I'm going to elaborate what he told.

Once you have installed FriendlyUrls package, there will be a file called Site.Mobile.Master. Double click and open it. Change CodeBehind="Default.aspx.cs" to CodeFile="Default.aspx.cs". Now open the file ViewSwitcher.ascx and change CodeBehind="ViewSwitcher.ascx.cs" to CodeFile="ViewSwitcher.ascx.cs".

Basically change every file where there is CodeBehind to CodeFile.

try importing the namespace

<%@ Import Namespace="Microsoft.AspNet.FriendlyUrls" %>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top