缺少已发布的ASP.NET应用程序的源代码

时间:2013-05-07 07:34:11

标签: asp.net vb.net

我有一个已发布并在服务器上工作的Web应用程序。我有 aspx 文件,但我没有 .vb 文件。我需要在应用程序中编辑单页。如何访问 .vb 文件?或者更好地说我如何在应用程序中编辑我想要的部分?

修改 这是我的aspx文件:

<%@ page language="VB" autoeventwireup="false" inherits="UrunRapor, App_Web_hfev-r-q" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v8.3, Version=8.3.6.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073" namespace="DevExpress.Web.ASPxGridView" tagprefix="dxwgv" %><%@ Register assembly="DevExpress.Web.ASPxGridView.v8.3, Version=8.3.6.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073" namespace="DevExpress.Web.ASPxGridView" tagprefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v8.3, Version=8.3.6.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v8.3.Export, Version=8.3.6.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073" namespace="DevExpress.Web.ASPxGridView.Export" tagprefix="dxwgv" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Ürün Detaylı Rapor</title>
    <script language="javascript">
            window.moveTo(0, 0);
            window.resizeTo(screen.availWidth, screen.availHeight);
        </script>    
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table style="font-size: 9pt; width: 474px; font-family: Calibri">
            <tr>
                <td style="width: 100px; height: 22px">
                    Ay</td>
                <td style="width: 100px; height: 22px">
                    <asp:DropDownList ID="cboMonth" runat="server" BackColor="#FFFFC0" Font-Bold="True"
                        Font-Names="Calibri" Font-Size="9pt">
                        <asp:ListItem Selected="True" Value="%%">[..]</asp:ListItem>
                        <asp:ListItem Value="1">January</asp:ListItem>
                        <asp:ListItem Value="2">February</asp:ListItem>
                        <asp:ListItem Value="3">March</asp:ListItem>
                        <asp:ListItem Value="4">April</asp:ListItem>
                        <asp:ListItem Value="05">May</asp:ListItem>
                        <asp:ListItem Value="06">June</asp:ListItem>
                        <asp:ListItem Value="07">July</asp:ListItem>
                        <asp:ListItem Value="08">August</asp:ListItem>
                        <asp:ListItem Value="09">September</asp:ListItem>
                        <asp:ListItem Value="10">October</asp:ListItem>
                        <asp:ListItem Value="11">November</asp:ListItem>
                        <asp:ListItem Value="12">December</asp:ListItem>
                    </asp:DropDownList></td>
                <td style="width: 100px; height: 22px">
                    Yıl
                </td>
                <td style="width: 100px; height: 22px">
                    <asp:DropDownList ID="cboYear" runat="server" BackColor="#FFFFC0" Font-Bold="True"
                        Font-Names="Calibri" Font-Size="9pt">
                        <asp:ListItem Selected="True" Value="%%">[..]</asp:ListItem>
                        <asp:ListItem Value="2007">2007</asp:ListItem>
                        <asp:ListItem Value="2008">2008</asp:ListItem>
                        <asp:ListItem Value="2009">2009</asp:ListItem>
                        <asp:ListItem Value="2010">2010</asp:ListItem>
                        <asp:ListItem>2011</asp:ListItem>
                        <asp:ListItem>2012</asp:ListItem>
                        <asp:ListItem>2013</asp:ListItem>
                        <asp:ListItem>2014</asp:ListItem>
                        <asp:ListItem>2015</asp:ListItem>
                    </asp:DropDownList></td>
                <td style="width: 100px; height: 22px">
                    <asp:Button ID="Button1" runat="server" Font-Bold="True" Font-Names="Calibri" Font-Size="9pt"
                        Text="Sorgula" /></td>
                <td style="width: 100px; height: 22px">
                    <asp:Button ID="Button2" runat="server" Font-Bold="True" Font-Names="Calibri" Font-Size="9pt"
                        Text="Excel'e aktar" /></td>
                <td style="width: 100px; height: 22px">
                    <asp:Button ID="Button3" runat="server" Font-Bold="True" Font-Names="Calibri" Font-Size="9pt"
                        Text="PDF dosyasına aktar" Width="123px" /></td>
            </tr>
        </table>

    </div>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CRRConnectionString %>">
            <SelectParameters>
                <asp:ControlParameter ControlID="cboMonth" Name="Month" PropertyName="SelectedValue" />
                <asp:ControlParameter ControlID="cboYear" Name="Year" PropertyName="SelectedValue" />
            </SelectParameters>
        </asp:SqlDataSource>
        <dxwgv:aspxgridview id="dgCRR" runat="server" datasourceid="SqlDataSource1">
<Settings ShowFilterRow="True" ShowFilterRowMenu="True" ShowFilterBar="Visible" 
                ShowGroupedColumns="True" ShowGroupPanel="True"></Settings>

<SettingsPager Visible="False" PageSize="1000" Position="TopAndBottom"></SettingsPager>
</dxwgv:aspxgridview>
        <dxwgv:ASPxGridViewExporter ID="ToExcel" runat="server">
        </dxwgv:ASPxGridViewExporter>
    </form>
</body>
</html>

她是我想要使用的.vb文件

Imports System.Globalization
Partial Class UrunRapor
    Inherits CRR.RequestBase
    Dim SelCmd As String
    Dim MyUser As String
    Dim dtreg As Data.DataTable

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        MyUser = Request.ServerVariables.Get("LOGON_USER")
        If Not Page.IsPostBack Then
            Dim dareg As Data.SqlClient.SqlDataAdapter = New Data.SqlClient.SqlDataAdapter
            dareg.SelectCommand = select_User(Request.ServerVariables.Get("LOGON_USER"))
            dareg.SelectCommand.Connection = cnn
            dtreg = New Data.DataTable
            dareg.Fill(dtreg)
            If dtreg.Rows.Count = 0 Then
                Response.Redirect("NotAuthRep.aspx")
            End If
            'Exit Sub
            'dgCRR.DataBind()
        End If
    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        FillGrid()
    End Sub


    Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
        FillGrid()
        ToExcel.FileName = "CRR-Product.pdf"
        ToExcel.WritePdfToResponse("CRR-Product.pdf")
    End Sub

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        'ToExcel.FileName = "CRRNew"
        'ToExcel.DataBind()
        FillGrid()
        ToExcel.GridViewID = "dgCRR"
        ToExcel.WriteXlsToResponse()
    End Sub
    Protected Sub FillGrid()
        SelCmd = "SELECT  tblCRRProductDetails.CRRId, tblCRRProductDetails.ProductCode, tblCRRProductDetails.ProductName, tblCRRProductDetails.Batch, tblCRRProductDetails.ExpireDate, tblCRRProductDetails.Qty, tblCRRProductDetails.SalesUnit, tblCRR.CrrCaptureDate, tblCRR.RegistrarName, tblCRR.CustomerCode, tblCRR.CustomerName, tblCRR.Channel, tblCRR.ClaimerName, tblCRR.ClaimerAddress, tblCRR.ClaimerPhone, tblCRR.ClaimerMail, tblCRR.CaseDetails, tblCRR.RsDeptName, tblCRR.ReasonName, tblCRR.RsPerName, tblCRR.ExpecRsDay, tblCRR.ExpecRsDate, tblCRR.RsDescription, tblCRR.ResolutionDate, tblCRR.ClaimResult, tblCRR.ActionPlan, tblCRR.ClosedPerName, tblCRR.ClosingDate,tblCRR.Status FROM tblCRRProductDetails INNER JOIN tblCRR ON tblCRRProductDetails.CRRId = tblCRR.CrrID WHERE (MONTH(CrrReceiveDate) LIKE '" & cboMonth.SelectedItem.Value & "') AND (YEAR(CrrReceiveDate) LIKE '" & cboYear.SelectedItem.Value & "')"
        SqlDataSource1.ConnectionString = "My Connection String"
        SqlDataSource1.SelectCommand = SelCmd
        dgCRR.DataBind()
    End Sub
End Class

3 个答案:

答案 0 :(得分:2)

发布站点时,编译的版本将在服务器上发布,而不是代码文件。您需要反汇编程序/反编译器来反编译dll文件。其中一些是

  1. .Net Reflecter
  2. ILSpy (免费)
  3. Dot Peek (免费)

答案 1 :(得分:2)

您可以做的是更改ASPX,例如,而不是:

<%@ Page Language="C#" CodeBehind="MyPage.aspx.cs" Inherits="MyNamespace.MyPage" %>

您可以这样更改:

<%@ Page Language="C#" Inherits="MyOtherNamespace.MyNewPage" %>

将新行为写入新的MyOtherNamespace.MyNewPage类(应该至少从System.Web.UI.Page派生),您可以将其放入bin目录中部署的任何.DLL程序集中。

您还可以从原始页面(仅引用原始程序集)派生此新类,而不是仅从System.Web.UI.Page派生,如果派生是您的选项,具体取决于您需要执行的更改

否则,您将不得不使用.NET Reflector或ILSpy等工具重建原始代码来构建这个新类,但至少,您不必触及现有的编译程序集。

答案 2 :(得分:0)

您可以尝试使用ilasm对其进行反汇编并直接编辑IL,但我认为现实中您将很难在没有源的情况下进行任何更改。 .cs文件是源文件。只有已编译的IL文件才能在发布的站点上使用。您将需要找出谁发布它并与他们谈论获取源。