Archivio

Archive for the ‘ASP.NET’ Category

AjaxControlToolkit rilasciata la versione 15.1 l’atteso ajax lato server per Asp.net

ASP.net Ajax  Rilasciata l’attesa nuova versione dell’ AJAX Control Toolkit l’utile Ajax lato server per Asp.Net. L’ultima rilascio del dicembre 2013 lasciava un po’ a desiderare tant’è che  si avvertiva la necessità di un aggiornamento. Con la nuova versione la v15.1 c’è stato un significativo lavoro di revisione e miglioramento che evidenzia al primo impatto maggiore velocità e stabilità dei componenti.   Le novità della nuova versione che ha come nuovo mantainer DevExpress: What’s new.

Con la nuova versione termina il supporto alle versioni di Asp.Net precedenti la 4.0.

Unica nota dolente è disponibile, al momento,  solo la versione installabile che necessita della presenza di Visual Studio. Va considerato che ora  è disponibile una versione free di Visual Studio: la versione community.

Comunque una volta installata la versione del Control Toolkit, e creata la prima web application per aggiornare altre web application che fanno uso dell’Ajax  Control ToolKit sarà sufficiente :

  • prelevare i binari dalla cartella /bin e copiarli nella web application da aggiornare sostituendo quindi i files della precedente versione
  • apportare le modifiche base per l’utilizzo della nuova versione in particolare la sostituzione del controllo  <ajaxToolkit:ToolkitScriptManager …  con <asp:ScriptManager  ….
    Esemplificando

    <ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server" />

    ora va sostituito con

    <asp:ScriptManager ID="ScriptManager2" runat="server" />


  • Eliminare se presenti dal web.config i riferimenti alla precedente versione del Control ToolKit
    come indicato in   Upgrade your project to AjaxControlToolkit v15.1 .
    Di fatto in web.config è sufficiente dichiarare il namespace AjaxControlToolkit

    <system.web>
    ......
       <pages>
           <controls>     
    ......
             <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit"/>
           </controls>
       </pages>
    </system.web>

 

Risorse:

 

Annunci

asp.net tabs ajax toolkits TabContainer evitare lo scroll della pagina

settembre 10, 2014 Lascia un commento

In Asp.net quando si utilizzo l’oggetto tabcontainers dell’ajax toolkits per generare tabulatori lato server, si assiste alla fastidiosa, a mio modo di vedere, conseguenza che la pagina una volta caricata si scrolla posizionandosi proprio a livello dei tabulatori presente nella pagina.

Per ovviare alla  scroll down provocato dall’oggetto tabcontainer si può inserire il seguente scripts nella pagina o control user asp.net.



        Sys.Extended.UI.TabContainer.prototype._app_onload = function (sender, e) {
            if (this._cachedActiveTabIndex != -1) {
                this.set_activeTabIndex(this._cachedActiveTabIndex);
                this._cachedActiveTabIndex = -1;

                var activeTab = this.get_tabs()[this._activeTabIndex];
                if (activeTab) {
                    activeTab._wasLoaded = true;
                    //activeTab._setFocus(activeTab);     // the only change made to this prototype
                }
            }
            this._loaded = true;
        }



 

IIS 8.0 There is a duplicate ‘system.web.extensions/scripting/scriptResourceHandler’ section defined

Trasferendo una web application ASP.NET da Windows 2008 server con IIS 7.5  a Windows Server 2012 con  IIS 8.0 può capitare di riscontrare il seguente messaggio di errore

There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' 
section defined

Due soluzioni possibili:

1) L’applicazione è assegnata ad un’ Application Pools non appropriato:
I progetti sviluppati con i frameworks dalla versione  2.0 alla verione 3.5 vanno assegnati ad un Application Pools con .NET FRAMEWORK VERSION v2.0.xxxx

I progetti sviluppati con in 4.0 e seguenti vanno assegnati ad un Application pools con .NET FRAMEWORK VERSION v4.0.xxxxx

Application Pools in Windows 2012 server con IIS 8.0

Application Pools

Applications Pools

2) Disabilitare commentando con <!–   –> le righe della sezione <sectionGroup name=”system.web.extensions”…> per le quali viene presentato il messaggio. Valutare adirittura di estendere il commento a tutta la sezione system.web.extension presente all’inizio ovviamente del file di configurazione web.config.

Esempio di commento

<!–section name=”scriptResourceHandler” type=”System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″ requirePermission=”false” allowDefinition=”MachineToApplication” /–>

Una volta commentate le righe ho sperimentato il funzionamento di applicazioni ASP.NET versione 3.5 anche una volta associate ad Application Pools 4.0

...
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
   <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
      <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
         <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
         <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
         <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
         <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
      </sectionGroup>
    </sectionGroup>
</sectionGroup>
...

Risorse:

AjaxControlToolkit.ToolkitScriptManager.CombineScriptsHandlerUrl’ is obsolete: ‘Please register AjaxControlToolkit.CombineScriptsHandler http handler instead.

When you use AjaxControlToolkit.ToolkitScriptManager and building/validating an asp.net application is showed the error message

AjaxControlToolkit.ToolkitScriptManager.CombineScriptsHandlerUrl’ is obsolete: ‘Please register AjaxControlToolkit.CombineScriptsHandler http handler instead.

and in the page is present this

<ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" 
  runat="server" CombineScriptsHandlerUrl="~/CombineScriptsHandler.ashx" />

you can fix by removing the attribute  CombineScriptsHandlerUrl=”~/CombineScriptsHandler.ashx” .

thus became

<ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server"  />

Risorse:

Asp.net web.config differenze tra versione 3.5 e 4.5

settembre 12, 2013 Lascia un commento

Di seguito le modifiche ad un file web.config di asp.net versione 3.5 affinchè risulti compatibile con la versione 4.5 del framework di asp.net. In generale la versione 4.5 di asp.net è più snella molte dichiarazioni non sono più necessarie.

Nel primo file compatibile con il framework asp.net 3.5 sono evidenziate:

  • in rosso sezioni/righe  tipiche del framework 3.5 che vengono eliminate nel 4.5
  • in blue quelle modificate
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <configSections>
     <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
 <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>
 <!-- application specific settings -->
 <appSettings>
    <add key="Server" value="192.168.1.157"/>
    <add key="DownloadareaMainPhysicalPath" value="G:\www\downloadarea" />
    ....      
 </appSettings>
 <system.webServer>
   <security>
     <requestFiltering allowDoubleEscaping="true" />
   </security>
     <modules>
        <remove name="ScriptModule" />
        <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
     </modules>
     <handlers>
         <remove name="WebServiceHandlerFactory-Integrated" />
         <remove name="ScriptHandlerFactory" />
         <remove name="ScriptHandlerFactoryAppServices" />
         <remove name="ScriptResource" />
        <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
 </handlers>
 </system.webServer>
 <system.web>
   <!-- globalization culture -->
   <globalization culture="it-IT" uiCulture="it-IT" requestEncoding="iso-8859-1" responseEncoding="iso-8859-1" />

 <sessionState timeout="15" />
 <!--
     Set compilation debug="true" to insert debugging
     symbols into the compiled page. Because this
     affects performance, set this value to true only
     during development.
 -->
 <compilation debug="true" defaultLanguage="c#">
    <assemblies>
       <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
       <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
       <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
       <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    </assemblies>
  </compilation>
  <httpHandlers>
     <remove verb="*" path="*.asmx" />
     <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
     <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
     <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
  </httpHandlers>
  <httpModules>
         <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  </httpModules>
 <!-- Portal supports either Forms authentication (Internet)
 or Windows authentication (for intranets). Forms Authentication is
 the default. To change to Windows authentication, comment the
 <authentication mode="Forms"> section below, and uncomment the
 <authentication mode="Windows"> section. -->
 <authentication mode="Forms">
    <!-- default timeout value 30 min (the timeout value is in minutes)-->
    <forms name=".ASPXFORMSAUTH" protection="All" timeout="60" />
    <!--forms name=".ASPXAUTH" protection="All" timeout="60" /-->
 </authentication>
 <!--<authentication mode="Windows" />
    <authorization>
    <deny users="?" />
 </authorization>-->

 <httpRuntime executionTimeout="500" maxRequestLength="10000" useFullyQualifiedRedirectUrl="true" />
 <urlMappings>
    <add url="~/AccessDenied.aspx" mappedUrl="~/portal.aspx?pg=access denied" />
    .... 
 </urlMappings>
 <customErrors mode="RemoteOnly">
     <error statusCode="405" redirect="~/portal.aspx?pg=HTTP 405" />
     <error statusCode="505" redirect="~/portal.aspx?pg=HTTP 505" />
     ...
 </customErrors>
 <pages validateRequest="false" enableViewStateMac="false" viewStateEncryptionMode="Auto">
    <namespaces>
       <add namespace="System.Globalization" />
       <add namespace="ASPNetPortal" />
       <add namespace="ASPNetPortal.Web.UI" />
    </namespaces>
    <controls>
       <add tagPrefix="ap" namespace="ASPNetPortal.Web.UI.WebControls" />
             <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
       <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit" />
            <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </controls>
 </pages>
 <!-- Adapter configuration for mobile controls used in the portal -->
 <mobileControls>
   <device name="PortalHtmlDeviceAdapters" inheritsFrom="HtmlDeviceAdapters">
      <control name="ASPNetPortal.MobileControls.TabbedPanel, Portal" adapter="ASPNetPortal.MobileControls.HtmlTabbedPanelAdapter,Portal" />
      <control name="ASPNetPortal.MobileControls.LinkCommand, Portal" adapter="ASPNetPortal.MobileControls.HtmlLinkCommandAdapter,Portal" />
   </device>
   <device name="PortalChtmlDeviceAdapters" inheritsFrom="ChtmlDeviceAdapters">
     <control name="ASPNetPortal.MobileControls.TabbedPanel, Portal" adapter="ASPNetPortal.MobileControls.ChtmlTabbedPanelAdapter,Portal" />
   </device>
   <device name="PortalWmlDeviceAdapters" inheritsFrom="WmlDeviceAdapters">
      <control name="ASPNetPortal.MobileControls.TabbedPanel, Portal" adapter="ASPNetPortal.MobileControls.WmlTabbedPanelAdapter,Portal" />
   </device>
 </mobileControls>
 <!-- Mobile device filters used for customizing portal -->
 <deviceFilters>
    <filter name="isJScript" compare="javascript" argument="true" />
    <filter name="isPocketIE" compare="browser" argument="Pocket IE" />
    <filter name="isHTML32" compare="preferredRenderingType" argument="html32" />
 </deviceFilters>
 </system.web>

 <location path="Admin">
   <system.web>
      <pages theme="ThAdmin" masterPageFile="~/TemplateAdmin.master" maintainScrollPositionOnPostBack="true"></pages>
   </system.web>
 </location>
 <location path="DesktopModules/EditMenu.aspx">
    <system.web>
       <pages theme="ThAdmin" masterPageFile="~/TemplateAdmin.master" maintainScrollPositionOnPostBack="true"></pages>
    </system.web>
 </location>
 ...
  
 <system.webServer>
 <directoryBrowse enabled="false" />
 <validation validateIntegratedModeConfiguration="false" />
 </system.webServer>
 <system.codedom>
   <compilers>
     <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
          <providerOption name="CompilerVersion" value="v3.5" />
          <providerOption name="WarnAsError" value="false" />
     </compiler>
     <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
          <providerOption name="CompilerVersion" value="v3.5" />
          <providerOption name="OptionInfer" value="true" />
          <providerOption name="WarnAsError" value="false" />
      </compiler>
   </compilers>
 </system.codedom>
 <runtime>
   <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v2.0.50727">
     <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
     </dependentAssembly>
     <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
     </dependentAssembly>
   </assemblyBinding>
 </runtime>
</configuration>


La versione 4.5 dello stesso web.config  decisamente più snella

<?xml version="1.0"?>
<configuration>

 <!-- application specific settings -->
 <appSettings>
    <add key="Server" value="192.168.1.157"/>
    <add key="DownloadareaMainPhysicalPath" value="G:\www\downloadarea" />
    ....      
 </appSettings>
 <system.webServer>
   <security>
     <requestFiltering allowDoubleEscaping="true" />
   </security>
 </system.webServer>
 <system.web>
   <!-- globalization culture -->
   <globalization culture="it-IT" uiCulture="it-IT" requestEncoding="iso-8859-1" responseEncoding="iso-8859-1" />

 <sessionState timeout="15" />
 <!--
     Set compilation debug="true" to insert debugging
     symbols into the compiled page. Because this
     affects performance, set this value to true only
     during development.
 -->
  <compilation debug="true" defaultLanguage="c#" targetFramework="4.5"/>
 <!-- Portal supports either Forms authentication (Internet)
 or Windows authentication (for intranets). Forms Authentication is
 the default. To change to Windows authentication, comment the
 <authentication mode="Forms"> section below, and uncomment the
 <authentication mode="Windows"> section. -->
 <authentication mode="Forms">
    <!-- default timeout value 30 min (the timeout value is in minutes)-->
    <forms name=".ASPXFORMSAUTH" protection="All" timeout="60" />
    <!--forms name=".ASPXAUTH" protection="All" timeout="60" /-->
 </authentication>
 <!--<authentication mode="Windows" />
    <authorization>
    <deny users="?" />
 </authorization>-->

 <httpRuntime executionTimeout="500" maxRequestLength="10000" useFullyQualifiedRedirectUrl="true" />
 <urlMappings>
    <add url="~/AccessDenied.aspx" mappedUrl="~/portal.aspx?pg=access denied" />
    .... 
 </urlMappings>
 <customErrors mode="RemoteOnly">
     <error statusCode="405" redirect="~/portal.aspx?pg=HTTP 405" />
     ...
 </customErrors>
 <pages validateRequest="false" enableViewStateMac="false" viewStateEncryptionMode="Auto" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
     <namespaces>
       <add namespace="System.Globalization" />
       <add namespace="ASPNetPortal" />
       <add namespace="ASPNetPortal.Web.UI" />
    </namespaces>
    <controls>
       <add tagPrefix="ap" namespace="ASPNetPortal.Web.UI.WebControls" />
       <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit" />
    </controls>
 </pages>
 <!-- Adapter configuration for mobile controls used in the portal -->
 <mobileControls>
   <device name="PortalHtmlDeviceAdapters" inheritsFrom="HtmlDeviceAdapters">
      <control name="ASPNetPortal.MobileControls.TabbedPanel, Portal" adapter="ASPNetPortal.MobileControls.HtmlTabbedPanelAdapter,Portal" />
      <control name="ASPNetPortal.MobileControls.LinkCommand, Portal" adapter="ASPNetPortal.MobileControls.HtmlLinkCommandAdapter,Portal" />
   </device>
   <device name="PortalChtmlDeviceAdapters" inheritsFrom="ChtmlDeviceAdapters">
     <control name="ASPNetPortal.MobileControls.TabbedPanel, Portal" adapter="ASPNetPortal.MobileControls.ChtmlTabbedPanelAdapter,Portal" />
   </device>
   <device name="PortalWmlDeviceAdapters" inheritsFrom="WmlDeviceAdapters">
      <control name="ASPNetPortal.MobileControls.TabbedPanel, Portal" adapter="ASPNetPortal.MobileControls.WmlTabbedPanelAdapter,Portal" />
   </device>
 </mobileControls>
 <!-- Mobile device filters used for customizing portal -->
 <deviceFilters>
    <filter name="isJScript" compare="javascript" argument="true" />
    <filter name="isPocketIE" compare="browser" argument="Pocket IE" />
    <filter name="isHTML32" compare="preferredRenderingType" argument="html32" />
 </deviceFilters>
 </system.web>

 <location path="Admin">
   <system.web>
      <pages theme="ThAdmin" masterPageFile="~/TemplateAdmin.master" maintainScrollPositionOnPostBack="true"></pages>
   </system.web>
 </location>
 <location path="DesktopModules/EditMenu.aspx">
    <system.web>
       <pages theme="ThAdmin" masterPageFile="~/TemplateAdmin.master" maintainScrollPositionOnPostBack="true"></pages>
    </system.web>
 </location>
 ...
  
 <system.webServer>
 <directoryBrowse enabled="false" />
 <validation validateIntegratedModeConfiguration="false" />
 </system.webServer>
</configuration>


L

Compatiblità di explorer con asp.net – hotfix problemi di visualizzazione

Non è una novità che Microsoft rilasci nuovi prodotti che finiscono per avere problemi di compatibilità con la tecnologia che Microsoft stessa promuove.  Uno di questi casi è il borwser Explorer in particolare la versione 10 che accedendo a siti sviluppati con asp.net, framework per web application promosso da Microsft,  presenta problemi di visualizzazione e interazione.  Può sembrare paradossale ma il problema affligge anche le web application di Microsoft come Sharepoint (SharePoint 2007, SharePoint 2010 and IE10 compatibility – Oliver Wirkus – SharePointCommunity ). Va evidenziato poi  che mentre Explorer presenta problmei di compatibilità  Chrome, Firefox e Safari interagiscono correttamente.

Quindi, come tradizione in queste situazioni,  Microsoft è costretta a rilasciare hotfix per risolvere il problema.  Nel caso specifico è possibile utilizare lo hotfix A hotfix is available for the ASP.NET browser definition files in the .NET Framework 2.0 SP2 and in the .NET Framework 3.5 SP1 che consente di aggiornare il i files con le definizioni dei browsers presenti in .NET Framework 2.0 SP2 e ..NET Framework 3.5 SP1. E’ necessario scaricare o farsi inviare via email come indicato in http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=2600100&kbln=en-us  lo hotfix specifico per il proprio  sistemi operativo.  Nel caso di Windows Server 2008 R2 64 bit, il file scaricato, decompresso,  è di tipo .msu. Windows6.1-KB2600100-x64.msu si installa automaticamente ma richiede il riavvio del sistema.

Hotfix Kb2600100

Hotfix Kb2600100

 

Hotfix Kb2600100 update

Hotfix Kb2600100 update

 

Hotfix Kb2600100 restart

Hotfix Kb2600100 restart

 

 

Confronto tra i metodi: ExecuteNonQuery, ExecuteReader, ExecuteScalar

I metodi ExecuteNonQuery, ExecuteReader, ExecuteScalar sono i tre principali metodi della classe SqlCommand.Gli oggetti risultanti, una volta instanziata la classe, consentono l’esecuzioni di istruzioni SQL e Stored Procedure in un Database di un Server SQL.

Il metodo ExecuteNonQuery viene usato per eseguire una instruzione SQL e stored procedure di tipo INSERT, DELETE e UPDATE. In questo caso il valore ritornato è il numero di record che sono stati interessati dal comando SQL. Più in generale viene usato per le action queries quindi oltre che per le istruzioni SQL UPDATE, INSERT, DELETE anche per le istruzioni CREATE, ATER, DROP.  Il valore ritornato ( result type ) è di tipo int. Se l’istruzioni SQL coinvolge records il result è il numero degli stessi diversamente è -1. Esempio in  asp.net c#   database postgresql con provider dati Npgsql

...
dbcon = new NpgsqlConnection(NpgsqlConnectionString);
dbcon.Open();
NpgsqlCommand command = new NpgsqlCommand( "DELETE FROM products WHERE itemid = 56", dbcon);
int result reader = command.ExecuteNonQuery();
...

Il metodo ExecuteReader ritorna una collezione di righe e colonne ( records ) e viene pertanto utilizzato per le istruzioni di tipo SELECT. Più in generale ExecuteReader lavora sia con query di tipo SELECT ( Non-Action ) che con le query di tipo Action. Il tipo ritornato essendo una collezione di records sara di tipo DataReader. Esempio in  asp.net c#   database postgresql con provider dati Npgsql

...
dbcon = new NpgsqlConnection(NpgsqlConnectionString);
dbcon.Open();
NpgsqlCommand command = new NpgsqlCommand( "SELECT * FROM products", dbcon);
IDataReader reader = command.ExecuteReader();
...

Il metodo ExecuteScalar ritorna la prima colonna della prima riga della query che viene  lanciata in esecuzione. Le rimanenti righe e colonne sono ignorate. Comodo nel caso di query di tipo Count.  Più in generale vien usato per le query di tipo Non Action con funzioni di aggregazione. Viene ritornato un valore di tipo object.

...
dbcon = new NpgsqlConnection(NpgsqlConnectionString);
dbcon.Open();
NpgsqlCommand command = new NpgsqlCommand( "SELECT COUNT(itemid) AS "Num.", productline FROM products GROUP BY productline", dbcon);
object result = command.ExecuteScalar();
...

Risorse: