使用DataPager时出现SecurityException

时间:2015-01-17 03:57:26

标签: asp.net vb.net

当我运行此页面时,我在应用程序中添加了一个DataPager控件,我收到以下错误。

  

安全例外

     

描述:

     

应用程序尝试执行安全策略不允许的操作。要授予此应用程序所需的权限,请与您的系统管理员联系或在配置文件中更改应用程序的信任级别。

     

异常详细信息:System.Security.SecurityException:请求类型为'System.Web.AspNetHostingPermission,System,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'的权限失败。

     

来源错误:

     

在执行当前Web请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息。

     

堆栈追踪:

     

[SecurityException:请求类型'System.Web.AspNetHostingPermission,System,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'的权限失败。      System.Reflection.Assembly._GetType(String name,Boolean throwOnError,Boolean ignoreCase)+0      System.Web.UI.NamespaceTagNameToTypeMapper.GetControlType(String tagName,IDictionary attribs,Boolean throwOnError)+98      System.Web.UI.NamespaceTagNameToTypeMapper.System.Web.UI.ITagNameToTypeMapper.GetControlType(String tagName,IDictionary attribs)+11      System.Web.UI.TagPrefixTagNameToTypeMapper.System.Web.UI.ITagNameToTypeMapper.GetControlType(String tagName,IDictionary attribs)+127      System.Web.UI.MainTagNameToTypeMapper.GetControlType2(String tagName,IDictionary attribs,Boolean fAllowHtmlTags)+228      System.Web.UI.MainTagNameToTypeMapper.GetControlType(String tagName,IDictionary attribs,Boolean fAllowHtmlTags)+28      System.Web.UI.RootBuilder.GetChildControlType(String tagName,IDictionary attribs)+20      System.Web.UI.ControlBuilder.CreateChildBuilder(String filter,String tagName,IDictionary attribs,TemplateParser parser,ControlBuilder parentBuilder,String id,Int32 line,VirtualPath virtualPath,Type& childType,Boolean defaultProperty)+69      System.Web.UI.TemplateParser.ProcessBeginTag(匹配匹配,String inputText)+526      System.Web.UI.TemplateParser.ParseStringInternal(String text,Encoding fileEncoding)+926

以下是代码

       <%@ Page Language="VB" MasterPageFile="~/CIOSMasterNonAuth.master"           AutoEventWireup="false" CodeFile="ViewOrdersChanged.aspx.vb" Inherits="ViewOrders" title="Untitled Page" %>

        <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

        <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <%--<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>--%>
                     <asp:Table runat="server" Font-Size="Small" HorizontalAlign="Center">
                     <asp:TableRow>
                     <asp:TableCell HorizontalAlign="Right">
                     <asp:Label runat="server">Order Status: </asp:Label>
                   </asp:TableCell>
           <asp:TableCell HorizontalAlign="Left">
           <asp:DropDownList ID="OrderStatusDropDownList" runat="server" AutoPostBack="True">
         <asp:ListItem Text="Verified" Value="V" />
         <asp:ListItem Text="New" Value="N" />
         <asp:ListItem Text="Cancelled" Value="C" />
                   </asp:DropDownList>
                         </asp:TableCell>
                      </asp:TableRow>
                                                       <asp:TableRow>
                       <asp:TableCell ColumnSpan="2">
                          <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
    <HeaderTemplate>
                                       <table border="1" visible="false">
                    <tr>
                        <th>
                            Web Order ID
                        </th>
                        <th>
                            Web Entry Date
                        </th>
                        <th>
                            Protocol Number
                        </th>
                        <th>
                            Site Number
                        </th>
                        <th>
                            Pharmacist of Record
                        </th>
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td>
                        <asp:LinkButton runat="server" ID="lnkOrderDetails" Text='<%# Eval("web_order_id") %>' OnClick="lnkOrderDetails_Click" />
                    </td>
                    <td>
                        <asp:Label ID="lblWebEntryDate" runat="server" Text='<%# Eval("web_entry_date") %>'>
                        </asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblProtocolNum" runat="server" Text='<%# Eval("protocol_num") %>'>
                        </asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblSiteNum" runat="server" Text='<%# Eval("site_num") %>'>
                        </asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblPharmName" runat="server" Text='<%# Eval("PharmName") %>'>
                        </asp:Label>                        
                    </td>

                </tr>
            </ItemTemplate>
                                  <FooterTemplate>
                </table>
            </FooterTemplate>
    </asp:Repeater>
    </asp:TableCell>
    </asp:TableRow>
</asp:Table>

           <asp:Button runat="server" ID="btnShowModalPopup" style="display:none"/>
           <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
    TargetControlID="btnShowModalPopup"
     PopupControlID="divPopUp" 
    PopupDragHandleControlID="panelDragHandle">
    </cc1:ModalPopupExtender>

           <div id="divPopUp" style="display:none; font-family:Georgia; font-size:small;">
            <asp:Panel runat="Server" ID="panelDragHandle" BackColor="#009999" BorderColor="ActiveBorder" BorderStyle="Ridge" ForeColor="White" Width="800px">
            <table width="100%">
          <tr>
            <td>
         Hold here to Drag this Box
        </td>
        <td align="right">
          <asp:Label runat="server" ID="lblText" Text="Web OrderID: " ForeColor="White"></asp:Label>

            <asp:Label ID="lblWebOrderID" runat="server"></asp:Label>
     </td>
     </tr>
     <tr>
     <td colspan="2"> 
               <asp:GridView ID="GridView2" runat="server" BackColor="#FFFFCC" ForeColor="Black" AutoGenerateColumns="False" Width="100%" >

     <Columns>
     <asp:BoundField DataField="line_id" HeaderText="Line Item"/>
     <asp:BoundField DataField="no_of_participants" HeaderText="Number of Participants" />
     <asp:BoundField DataField="amt_inventory" HeaderText="Current Inventory"/>
     <asp:BoundField DataField="nsc_num" HeaderText="NSC number"/>
     <asp:BoundField DataField="drug_name" HeaderText="Drug name"/>
     <asp:BoundField DataField="dose_str" HeaderText="Dose Strength"/>
     <asp:BoundField DataField="dose_unit" HeaderText="Dose Unit"/>
     <asp:BoundField DataField="dose_form_comment" HeaderText="Dose Form"/>
     <asp:BoundField DataField="dose_mult" HeaderText="Dose Mult" />
     <asp:BoundField DataField="amt_req" HeaderText="Amt Required"/>
     </Columns>
     </asp:GridView> 
     </td> 
     </tr>
     <tr> 
                       <td colspan="2" align="right">                       
    <asp:Button ID="btnClose" runat="server" Text="Close" />
    </td>
    </tr>
    </table>
    </asp:Panel>
   <br />

</div>


              <asp:SqlDataSource ID="SqlDataSource1" runat="server"   ConnectionString="
               <%$ ConnectionStrings:CIOSConnectionString3 %>" SelectCommand="SELECT w.web_order_id, w.web_entry_date, w.site_num, w.protocol_num, w.inv_num, w.pharm_num, w.status, w.Comments, w.UserName, w.porStatus, ISNULL(p.Pharm_fname, ' ') + ' ' + ISNULL(p.Pharm_lname, ' ') AS 'PharmName' FROM Web_Shipping AS w INNER JOIN Pharmacist_of_record AS p ON p.pharm_num = w.pharm_num WHERE (w.status = @status) ORDER BY w.web_order_id DESC" >
         <SelectParameters>
            <asp:ControlParameter ControlID="OrderStatusDropDownList" Name="Status" 
                PropertyName="Text" Type="Char" />
                </SelectParameters>
        </asp:SqlDataSource>

         <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:CIOSConnectionString3 %>" 

        SelectCommand="SELECT Web_Ship_detail.line_id, Web_Ship_detail.no_of_participants, Web_Ship_detail.Amt_inventory, Web_Ship_detail.NSC_num, Web_Ship_detail.Dose_str, Web_Ship_detail.Dose_unit, Web_Ship_detail.Dose_mult, Web_Ship_detail.amt_req, Drug.Drug_name, Dosage_Form.dose_form_comment FROM Web_Ship_detail INNER JOIN Drug ON Web_Ship_detail.NSC_num = Drug.NSC_Num INNER JOIN Dosage_Form ON Web_Ship_detail.Dose_form = Dosage_Form.dose_form WHERE (Web_Ship_detail.web_order_id = @web_order_id) ORDER BY Web_Ship_detail.line_id">
        <SelectParameters>
            <asp:ControlParameter ControlID="lblWebOrderID" Name="web_order_id" 
                PropertyName="Text" Type="Decimal" />
        </SelectParameters>
   </asp:SqlDataSource>

    <asp:DataPager ID="DataPager1" 
                   PagedControlID="OrderStatusDropDownList" 
                   PageSize="5"  runat="server">
      <Fields>
            <asp:NextPreviousPagerField ButtonType="Button" 
            ShowFirstPageButton="true" 
            ShowLastPageButton="true"
            ShowNextPageButton="true"  
            ShowPreviousPageButton="true"  />
       </Fields>

    </asp:DataPager>

</asp:Content>

0 个答案:

没有答案