使用vb.net在ASP.NET MVC中进行本地化我无法运行我的项目。
Public Class LocalizationWebFormViewEngine
Inherits WebFormViewEngine
Protected Overrides Function CreateView(controllerContext As ControllerContext, viewPath As String, masterPath As String) As IView
Return New LocalizationWebFormView(viewPath, masterPath)
End Function
Protected Overrides Function CreatePartialView(controllerContext As ControllerContext, partialPath As String) As IView
Return New LocalizationWebFormView(partialPath, Nothing)
End Function
End Class
Public Class LocalizationWebFormView
Inherits WebFormView
Friend Const ViewPathKey As String = "__ViewPath__"
**Public Sub New(viewPath As String)
MyBase.New(viewPath)
End Sub
Public Sub New(viewPath As String, masterPath As String)
MyBase.New(viewPath, masterPath)
End Sub**
Public Overrides Sub Render(viewContext As ViewContext, writer As TextWriter)
' there seems to be a bug with RenderPartial tainting the page's view data
' so we should capture the current view path, and revert back after rendering
Dim originalViewPath As String = DirectCast(viewContext.ViewData(ViewPathKey), String)
viewContext.ViewData(ViewPathKey) = ViewPath
MyBase.Render(viewContext, writer)
viewContext.ViewData(ViewPathKey) = originalViewPath
End Sub
End Class
3给出错误。
1. 重载解析失败,因为没有可访问的'New'接受此数量的参数
Public Sub New (viewpath As String)
MyBase.New (viewpath)
End Sub
2.value无法转换为system.web.mvc.controllercontext的类型
Public Sub New (viewpath As String, String masterpath)
MyBase.New (viewpath, masterpath)
End Sub
3.Public override sub render(作为systemContext as system.web.mvc.viewcontext,TextWriter writer无法覆盖'Public sub render'未声明,因为可覆盖
解决方案:替换阴影覆盖
Public Overrides Sub Render(ViewContext ViewContext Ace,Ace TextWriter writer)
如何修复与vb.net相关的错误。
谢谢。