How to register an assembly in the Razor view engine

How can I insert this into a razor watch page

<%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls" TagPrefix="asp" %> <asp:ScriptManager runat="server" ID="MainScriptManager" /> 
+6
source share
4 answers

You can put it in Web.Config , which exists in your Views folder. It took me a while to realize that it was a hope that it helped.

 <system.web> <controls> <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" /> <add assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagPrefix="ajaxToolkit" /> </controls> </system.web> 
+7
source

You can not. You are using ASPX markup in your example. In a razor you can write:

 @using System.Web.Silverlight; 

by the way. check the quickref syntax :

+2
source

you can try @using Namespace; where the namespace is what you need

+1
source

To add a new register in MVC, you can put in web.config:

 <configuration> <system.web> <pages> <controls> <add assembly="System.Web.Silverlight" namespace="System.Web.UI.SilverlightControls" tagPrefix="asp" /> </controls> </pages> </system.web> </configuration> 
0
source

Source: https://habr.com/ru/post/886704/


All Articles