Preparar web.config para html5 y css3

Ref: http://madskristensen.net/post/prepare-webconfig-for-html5-and-css3

 

HTML5 and CSS3 introduces some new file types that enables us to create even better websites. We are now able to embed video, audio and custom fonts natively to any web page. Some of these file types are relatively new and not supported by the IIS web server by default. It’s file types like .m4v, .webm and .woff.

When a request is made to the IIS for these unsupported file types, we are met with the following error message:

HTTP Error 404.3 – Not Found

The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

The problem is that the IIS doesn’t know how to serve these new files unless we tell it how. This can be easily done in the web.config’s <system.webServer> section by adding the following snippet:

<staticContent>
    <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
    <mimeMap fileExtension=".m4v" mimeType="video/m4v" />
    <mimeMap fileExtension=".ogg" mimeType="video/ogg" />
    <mimeMap fileExtension=".ogv" mimeType="video/ogg" />
    <mimeMap fileExtension=".webm" mimeType="video/webm" />

    <mimeMap fileExtension=".oga" mimeType="audio/ogg" />
    <mimeMap fileExtension=".spx" mimeType="audio/ogg" />

    <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
    <mimeMap fileExtension=".svgz" mimeType="image/svg+xml" />

    <remove fileExtension=".eot" />
    <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
    <mimeMap fileExtension=".otf" mimeType="font/otf" />
    <mimeMap fileExtension=".woff" mimeType="font/x-woff" />
</staticContent>

The above snippet includes support for most video, audio and font file types used by HTML5 and CSS3

Herramientas Bootstrap

29-09-2016:

Checkboxes y Radio Buttons para Bootstrap

Pretty Checkbox & Radio Inputs with Bootstrap and awesome-bootstrap-checkbox.css

Recursos Bootstrap Official:

http://startbootstrap.com/bootstrap-resources/

Dialogos modales:

https://nakupanda.github.io/bootstrap3-dialog/

Plugins varios:

http://webrevisions.com/bootstrap-plugin/50-super-useful-twitter-bootstrap-plugins/#.Vw6FbvnhCM8

Plugin de recorte de imagenes:

http://www.croppic.net/

Plantillas Bootstrap

https://almsaeedstudio.com/themes/AdminLTE/index.html

Plugin para Wizards

http://vadimg.com/twitter-bootstrap-wizard-example/#

Validacion de formularios:

http://formvalidation.io/

Utilizar jquery ui con ASP .NET

Colocando esta linea de codigo funcionó los componentes de jquery ui con .NET

html aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AsistenteVentas.aspx.cs" Inherits="Mantenimientos.AsistenteVentas" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 <title></title>
 <link href="css/custom.css" rel="stylesheet" />
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
 <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css" />
 <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
</head>
 <script type="text/javascript">
 function InIEvent()
 {
 $(function () {
 var xdialog;
xdialog = $('#BuscaPersonal').dialog({
 modal: true,
 autoOpen: false,
 height: 300,
 width: 650
 });
$('#xbtn_buscar').on('click', function () {
 xdialog.dialog('open');
 $('#hddorigen').val('ASISTVTA');
 });
xdialog.parent().appendTo($('form:first'));
 });
 }
$(document).ready(InIEvent);
 
 </script>
<body>
 <form id="form1" runat="server">
 <asp:ScriptManager runat="server"></asp:ScriptManager>
 <script type="text/javascript">
 Sys.WebForms.PageRequestManager.getInstance().add_endRequest(InIEvent);
 </script>
 <div class="contenido">
 <h2>Asistentes de Ventas</h2>
 <div>
 <div>
 <table>
 <tr>
 <td> 
 <asp:ImageButton ID="btnNuevoAsisVta" runat="server" ImageUrl="~/img/nuevo.png" Width="16px" OnClick="btnNuevoAsisVta_Click" />
 </td>
 </tr>
 </table>
 </div>
 <%-- Panel de mantenimiento de asistentes de ventas --%>
 <asp:UpdatePanel ID="updpnlMtoAsistVta" runat="server" UpdateMode="Conditional">
 <ContentTemplate>
 <asp:Panel ID="pnlmtoAsistVta" runat="server">
 <table class="form-tabla">
 <tr>
 <td>Codigo</td>
 <td>:</td>
 <td><asp:TextBox ID="txtcodigoAsistvta" runat="server" ReadOnly="true" Width="50px"></asp:TextBox></td>
 <td><img src="img/search.png" width="32" alt="" id="xbtn_buscar" class="img-boton" /></td>
 </tr>
 <tr>
 <td>Nombres y Apellidos</td>
 <td>:</td>
 <td colspan="2"><asp:TextBox ID="txtnomyape" runat="server" ReadOnly="true" Width="200px"></asp:TextBox></td>
 </tr>
 <tr>
 <td>Correo Electrónico</td>
 <td>:</td>
 <td colspan="2"><asp:TextBox ID="txtcorreo" runat="server" ReadOnly="true" Width="200px"></asp:TextBox></td>
 </tr>
 <tr>
 <td>L&iacute;nea</td>
 <td>:</td>
 <td colspan="2"><asp:DropDownList ID="ddl_linea" runat="server" Width="150px"></asp:DropDownList></td>
 </tr>
 <tr class="form-fila-botones">
 <td colspan="2"><asp:ImageButton ID="btnguardarAsisVta" runat="server" ImageUrl="~/img/save.png" Width="32" /></td>
 <td colspan="2"><asp:ImageButton ID="btnregresarAsisVta" runat="server" ImageUrl="~/img/back.png" Width="32" OnClick="btnregresarAsisVta_Click" /></td>
 </tr>
 </table>
 <asp:Label ID="lblmensaje1" runat="server"></asp:Label>
 </asp:Panel>
 </ContentTemplate>
 <Triggers>
 <asp:AsyncPostBackTrigger ControlID="btnguardarAsisVta" EventName="Click" />
 <asp:AsyncPostBackTrigger ControlID="btnregresarAsisVta" EventName="Click" />
 <asp:AsyncPostBackTrigger ControlID="btnNuevoAsisVta" EventName="Click" />
 </Triggers>
 </asp:UpdatePanel>
<div> 
 <%-- Grilla de asistentes de ventas --%>
<asp:GridView ID="gvAsistentes" runat="server" AutoGenerateColumns="False">
 <Columns>
 <asp:TemplateField HeaderText="ID"> 
 <ItemTemplate>
 <asp:LinkButton ID="lnkID" runat="server" Text='<%# Eval("codigo").ToString() %>'></asp:LinkButton>
 </ItemTemplate>
 </asp:TemplateField>
 <asp:BoundField DataField="linea" HeaderText="Linea" />
 <asp:BoundField DataField="nombres" HeaderText="Nombres y Apellidos" />
 <asp:BoundField DataField="correo" HeaderText="Correo electronico" />
 <asp:TemplateField>
 <ItemTemplate>
 <asp:ImageButton ID="btneliminar" runat="server" ImageUrl="~/img/eliminar.png" Width="16" /> 
 </ItemTemplate>
 </asp:TemplateField>
 </Columns>
 </asp:GridView>
 </div>
 <div id="BuscaPersonal" class="widget" title="Busqueda de personal">
 <div>
 <%-- LA BUSQUEDA DE PERSONAL --%>
 <asp:Panel ID="pnl_buscar" runat="server" DefaultButton="btn_buscar">
 <table class="form-tabla">
 <tr>
 <td>Ingrese nombres o correo electrónico</td>
 <td>:</td>
 <td><asp:TextBox ID="txtbuscar" runat="server" Width="300px"></asp:TextBox></td>
 <td><asp:ImageButton ID="btn_buscar" runat="server" ImageUrl="~/img/search.png" Width="32" OnClick="btn_buscar_Click" /></td>
 </tr>
 </table> 
 </asp:Panel>
 </div>
 <asp:UpdatePanel ID="upd1" runat="server" UpdateMode="Conditional">
 <ContentTemplate>
 <asp:GridView ID="gvpersonal" runat="server" AutoGenerateColumns="False" CssClass="grid-net" >
 <Columns>
 <asp:TemplateField HeaderText="Codigo"> 
 <ItemTemplate>
 <asp:LinkButton ID="lnkpersonal" runat="server" Text='<%# Eval("CodigoPersona").ToString() %>'></asp:LinkButton>
 </ItemTemplate>
 </asp:TemplateField>
 <asp:BoundField DataField="NombresApellidos" HeaderText="Nombres y Apellidos" />
 <asp:BoundField DataField="CorreoElectronico" HeaderText="Correo electronico" />
 </Columns>
 </asp:GridView> 
 <asp:HiddenField ID="hddorigen" runat="server" /> 
 </ContentTemplate>
 <Triggers>
 <asp:AsyncPostBackTrigger ControlID="btn_buscar" EventName="Click" />
 </Triggers>
 </asp:UpdatePanel> 
 <div>
</div>
 </div>
<div>
 <%-- LA BUSQUEDA DE PERSONAL --%>
 <h3>Personal de Ventas</h3>
 <div>
 <table>
 <tr>
 <td><asp:ImageButton ID="img_nuevo_vta" runat="server" ImageUrl="~/img/nuevo.png" Width="16px" /></td>
 </tr>
 </table>
 </div>
 <div>
 <asp:GridView ID="gv_ventas" runat="server" AutoGenerateColumns="False">
 <Columns>
 <asp:BoundField DataField="codigo" HeaderText="Codigo" />
 <asp:BoundField DataField="nombres" HeaderText="Nombres y Apellidos" />
 <asp:BoundField DataField="correo" HeaderText="Correo electrónico" />
 <asp:TemplateField>
 <ItemTemplate>
 <asp:ImageButton ID="img_eliminar_vta" runat="server" ImageUrl="~/img/eliminar.png" Width="16px" />
 </ItemTemplate>
 </asp:TemplateField>
 </Columns>
 </asp:GridView>
 </div>
 </div>
 <div>
 <table>
 <tr>
 <td>
</td>
 </tr>
 </table>
 </div>
 </div>
 </div>
 </form>
</body>
</html>

Codigo C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTO;
using ENT;

namespace Mantenimientos
{
 public partial class AsistenteVentas : System.Web.UI.Page
 {
 protected void Page_Load(object sender, EventArgs e)
 {
 if (!(Page.IsPostBack))
 {
 DTOAsistVta obj = new DTOAsistVta();
 List<ENTLinea> lstLinea = obj.ListarLineas();

 if (lstLinea.Count == 1 && lstLinea[0].Mensaje != null)
 {
 ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", string.Format("alert('Ha ocurrido un error: {0}", lstLinea[0].Mensaje), true);
 return;
 }

 this.ddl_linea.DataSource = lstLinea;
 this.ddl_linea.DataTextField = "NombreLinea";
 this.ddl_linea.DataValueField="CodigoLinea";
 this.DataBind();

 this.ddl_linea.Items.Insert(0, new ListItem("...Seleccione", "0"));
 //this.pnlmtoAsistVta.Style.Add(HtmlTextWriterStyle.Display, "none");
 this.pnlmtoAsistVta.Visible = false;
 }
 }

 protected void btn_buscar_Click(object sender, ImageClickEventArgs e)
 {
 DTOAsistVta obj = new DTOAsistVta();

 List<ENTPersona> lstpersona = obj.ListarColaboradores(this.txtbuscar.Text.Trim());
 
 //Verificando que no haya error

 if (lstpersona.Count == 1 && lstpersona[0].Mensaje != null)
 {
 ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", string.Format("alert('Ha ocurrido un error: {0}", lstpersona[0].Mensaje), true);
 return;
 }

 this.gvpersonal.DataSource = lstpersona;
 this.gvpersonal.DataBind();
 }

 protected void btnNuevoAsisVta_Click(object sender, ImageClickEventArgs e)
 {
 //this.pnlmtoAsistVta.Style.Add(HtmlTextWriterStyle.Display, "inline");
 this.pnlmtoAsistVta.Visible = true;
 }

 protected void btnregresarAsisVta_Click(object sender, ImageClickEventArgs e)
 {
 this.pnlmtoAsistVta.Visible = false;
 }


 }
}

Solucion error WCF IIS: Memoria disponible menor al 5%

El detalle del error mostrado por IIS es:

Memory gates checking failed because the free memory (373817344 bytes) is less than 5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InsufficientMemoryException: Memory gates checking failed because the free memory (373817344 bytes) is less than 5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element

Se ha solucionado añadiendo las siguientes lineas en el web config de la aplicación

<system.serviceModel> 
    <serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" />
</system.serviceModel>