VB.NET 转成 asp.net 各位拜托了.
Imports Microsoft.VisualBasic
Public Class FormRewriterControlAdapter
Inherits System.Web.UI.Adapters.ControlAdapter
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
MyBase.Render(New RewriteFormHtmlTextWriter(writer))
End Sub
End Class
Public Class RewriteFormHtmlTextWriter
Inherits HtmlTextWriter
Sub New(ByVal writer As HtmlTextWriter)
MyBase.New(writer)
Me.InnerWriter = writer.InnerWriter
End Sub
Sub New(ByVal writer As System.IO.TextWriter)
MyBase.New(writer)
MyBase.InnerWriter = writer
End Sub
Public Overrides Sub WriteAttribute(ByVal name As String, ByVal value As String, ByVal fEncode As Boolean)
If (name = "action ") Then
Dim Context As HttpContext
Context = HttpContext.Current
If Context.Items( "ActionAlreadyWritten ") Is Nothing Then
value = Context.Request.RawUrl
Context.Items( "ActionAlreadyWritten ") = True
End If
End If
MyBase.WriteAttribute(name, value, fEncode)
End Sub
End Class
我想把以上的转换为asp.net的CS 但是 自己VB又不好 翻译不过来.
希望各位帮下了.
------解决方案-------------------- Public Class FormRewriterControlAdapter
Inherits System.Web.UI.Adapters.ControlAdapter
Protected Overrides Sub Render(System.Web.UI.HtmlTextWriter writer)
{
MyBase.Render(New RewriteFormHtmlTextWriter(writer));
}
Public Class RewriteFormHtmlTextWriter
Inherits HtmlTextWriter;
HtmlTextWriter writer=new HttpTextWriter();
writer=MyBase.New(writer);
Me.InnerWriter