Salve, nell'utilizzare il database Mysql in una pagina:
Imports System.IO
Imports System
Imports System.Net
Imports System.Data
Imports System.Data.SqlClient
Imports MySql.Data
Imports MySql.Data.MySqlClient
Imports System.Web.UI
Imports System.DateTime
Protected Sub ButtonFiltra_Click(sender As Object, e As EventArgs)
Dim strSQL As String
Dim strSQLBase As String = "SELECT ts_logins.id, ts_logins.user_id, ts_logins.start, ts_logins.end, ts_logins.postazione_id,
ts_users.name, ts_postazioni.nome FROM (ts_logins INNER JOIN ts_users ON ts_logins.user_id = ts_users.id) INNER JOIN ts_postazioni ON
ts_logins.postazione_id = ts_postazioni.id "
Dim strSQLWHERE As String = " WHERE ts_postazioni.nome='" & txtPostazione.Text & "' AND ts_logins.start>='" &
LabelDataFiltro.Text & " 00:00:00' AND ts_logins.end IS NULL"
LabelSQL.Text = strSQLBase + strSQLWHERE
strSQL = strSQLBase + strSQLWHERE
Dim constr As String = ConfigurationManager.ConnectionStrings("ConnectionLime").ConnectionString
Using con As New MySqlConnection(constr)
Using cmd As New MySqlCommand(strSQL)
Using sda As New MySqlDataAdapter()
cmd.Connection = con
sda.SelectCommand = cmd
Using dt As New DataTable()
sda.Fill(dt)
GridViewLimets_logins.DataSource = dt
GridViewLimets_logins.DataBind()
End Using
End Using
End Using
End Using
End Sub
Html
<asp:GridView ID="GridViewLimets_logins" runat="server" AutoGenerateColumns="false" Width="100%" >
<Columns>
</asp:BoundField>
<asp:BoundField DataField="user_id" HeaderText="UserId" ReadOnly="True" >
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" ForeColor="#000000"
BorderWidth="1px" BorderStyle="Solid" BorderColor="#DEDFDE" />
</asp:BoundField>
<asp:BoundField DataField="start" HeaderText="start" ReadOnly="True" >
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" ForeColor="#000000"
BorderWidth="1px" BorderStyle="Solid" BorderColor="#DEDFDE" />
</asp:BoundField>
<asp:BoundField DataField="end" HeaderText="end" ReadOnly="True" >
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" ForeColor="#000000"
BorderWidth="1px" BorderStyle="Solid" BorderColor="#DEDFDE" />
</asp:BoundField>
<asp:BoundField DataField="postazione_id" HeaderText="postazione_id" ReadOnly="True"
>
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" ForeColor="#000000"
BorderWidth="1px" BorderStyle="Solid" BorderColor="#DEDFDE" />
</asp:BoundField>
<asp:BoundField DataField="name" HeaderText="Operatore" ReadOnly="True" >
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" ForeColor="#000000"
BorderWidth="1px" BorderStyle="Solid" BorderColor="#DEDFDE" />
</asp:BoundField>
<asp:BoundField DataField="nome" HeaderText="Postazione" ReadOnly="True" >
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" ForeColor="#000000"
BorderWidth="1px" BorderStyle="Solid" BorderColor="#DEDFDE" />
</asp:BoundField>
</Columns>
<HeaderStyle BackColor="#004466" Font-Bold="True" ForeColor="white"
HorizontalAlign="Center" />
</asp:GridView>
il server di Aruba mi ritorna questo errore:
That assembly does not allow partially trusted callers.
System.Security.SecurityException: That assembly does not allow partially trusted callers. at _Default.SettaggiIniziale() at _Default.Page_Load(Object sender, EventArgs e) in D:\inetpub\webs\scqualitaeu\xxx.aspx.vb:line 43 at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.xxx_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) The action that failed was: LinkDemand The assembly or AppDomain that failed was: App_Web_qwbby3zd, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null The Zone of the assembly that failed was: MyComputer The Url of the assembly that failed was: file:///d:/AspnetTemp/site/scqualita.eu/v4.0/root/0404b879/20ec7ca1/App_Web_qwbby3zd.DLL
di seguito il file web.config:
?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=D:\inetpub\webs\scqualitaeu\public\;" />
</appSettings>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4194304" />
</requestFiltering>
</security>
<handlers>
<remove name="ChartImageHandler" />
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd"
type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>
<connectionStrings>
<add name="ConnectionLime" connectionString="server=xxx.xxx.xxx.xxx;database=limesurvey;User Id=xxx;password=xxx;"
providerName="MySql.Data.MySqlClient" />
<add name="DefaultConnection" connectionString="Data Source= xxx.xxx.xxx.xxx;Initial Catalog=MSSqlxxxxxxx;Integrated Security=False;User ID=xxx;
pwd=xxx; Connect Timeout=0;Encrypt=False;Packet Size=4096"/>
</connectionStrings>
<system.web>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</controls>
</pages>
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
</httpHandlers>
<compilation debug="true" targetFramework="4.8">
<assemblies>
<add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.ComponentModel.Composition, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Numerics.Vectors, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.ComponentModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
</assemblies>
</compilation>
<authentication mode="Forms" />
<httpRuntime maxRequestLength="3200" executionTimeout="102400" />
</system.web>
<system.web>
<customErrors mode="Off"/>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.8.9.0" newVersion="1.8.9.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
I database utilizzati e l'hosting sono sui server Aruba.
potete aiutarmi a capire come risolvere?
Attendo Vs
Saluti