整合Web表单asp使用visual basic和ASP MVC 4使用C#

时间:2017-03-02 03:31:19

标签: c# vb.net model-view-controller webforms

我在2个项目之间遇到了Application_Start()问题。 这是Global.asax.cs中的Application_Start()MVC4

public partial class MvcApplication : System.Web.UI.Page
{
    protected void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);
    }
}

这是Application_Start()asp Webform在Global.asax中使用visual basic

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)


    Application("A2BasePage") = "Default.aspx"

    Application("GvTableTitleColor") = "#003366"
    Application("GvCaptionColor") = "#000000" '"#FFFFFF"
    Application("GvCaptionBackColor") = "#C0C0C0" '"#336699"
    Application("GvSystemBackColor") = "#F0F0E1"


    '---Global Color
    Application("GvTableTitleColor") = "#003366"
    Application("GvCaptionColor") = "#000000" '"#FFFFFF"
    Application("GvCaptionBackColor") = "#C0C0C0" '"#336699"
    Application("GvSystemBackColor") = "#F0F0E1"
End Sub

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
    ' Code that runs on application shutdown

End Sub

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    ' Code that runs when an unhandled error occurs
End Sub



Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
    Session.Timeout = 180

    Session("RapidISDBType") = "SQLServer"
    Session("RapidISUserIDPassword") = "User ID=xx;Password=xx"
    Session("RapidISServerName") = "x.x.x.x"
    Session("RapidISDBName") = "xx"

    Dim strDefaultAppName As String = ""
    If Session("GvAppName") <> "" Then
        strDefaultAppName = Session("GvAppName")
        strDefaultAppName = "xx"
    Else
        strDefaultAppName = "xx"
    End If

    Dim objA2Global As xx
    'objA2Global = New xx
    If objA2Global.SetAppSessions(xx, Session("RapidISServerName"), Session("Rxx"), Session("xx"), Session, True) Then
        'ErrorMsg.Text = ""
    Else
        'ErrorMsg.Text = "No Data In Records"
    End If


End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
    ' Code that runs when a session ends. 
    ' Note: The Session_End event is raised only when the sessionstate mode
    ' is set to InProc in the Web.config file. If session mode is set to StateServer 
    ' or SQLServer, the event is not raised.
End Sub

如何整合两个文件。请帮帮我。

0 个答案:

没有答案