Monday, September 30, 2019

HTML Report or HTML Print

 A  
1.Design



2.Html


<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style>
     
        table{
            border-collapse:collapse;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <table class="tbl" width="420" height="595" border="1" >
            <tr>
                <td valign="top">
                    <table height="100" width="100%">
                        <tr>
                            <td>

                            </td>
                        </tr>
                    </table>
                    <table width="100%" height="50" border="1">
                        <tr>
                            <td width="50">Name</td>
                            <td></td>
                            <td width="50">Address</td> 
                            <td></td>
                        </tr>                     
                    </table>
                    <table width="100%" height="80" border="1">
                        <tr>                         
                            <td>Wages</td>                           
                            <td>Roll No</td>
                            <td>Plant</td>                           
                            <td>Sallary</td>
                            <td>Join Date</td>                           
                        </tr> 
                        <tr>                         
                            <td>Raj Kumar</td>                           
                            <td>9898989</td>
                            <td>Agra</td>                           
                            <td>50000</td>
                            <td>12-Aug-2019</td>                           
                        </tr>
                    </table>
                     <table width="100%" height="45" border="1">
                        <tr>                         
                            <td>Wages</td>                           
                            <td>Roll No</td>
                            <td>Plant</td>                           
                            <td>Sallary</td>
                            <td>Join Date</td>                           
                        </tr> 
                     
                    </table>
                    <table height="150" width="100%">
                        <tr>
                            <td>

                            </td>
                        </tr>
                    </table>
                    <table height="" width="100%">
                        <tr>
                            <td align="center">
                                 hdkfjhadjshfkhkdshfjdh ljdhfkadshfads fhkja<br>
                                Adfhjkdshf  jdhfjhdskfhs
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </form>
</body>
</html>







B

1.Design



2.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style>
        table {
            border-collapse: collapse;
        }

        .center {
            width: 400px;
            margin-left: 10px;
            margin-right: 10px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <table class="tbl" width="420" height="595" border="1">
            <tr>
                <td valign="top">
                    <table height="100" width="100%">
                        <tr>
                            <td></td>
                        </tr>
                    </table>
                    <table class="center">
                        <tr>
                            <td>
                                <table width="100%" height="50" border="1">
                                    <tr>
                                        <td width="50">Name</td>
                                        <td></td>
                                        <td width="50">Address</td>
                                        <td></td>
                                    </tr>
                                </table>
                                <table width="100%" height="80" border="1">
                                    <tr>
                                        <td>Wages</td>
                                        <td>Roll No</td>
                                        <td>Plant</td>
                                        <td>Sallary</td>
                                        <td>Join Date</td>
                                    </tr>
                                    <tr>
                                        <td>Raj Kumar</td>
                                        <td>9898989</td>
                                        <td>Agra</td>
                                        <td>50000</td>
                                        <td>12-Aug-2019</td>
                                    </tr>
                                </table>
                                <table width="100%" height="45" border="1">
                                    <tr>
                                        <td>Wages</td>
                                        <td>Roll No</td>
                                        <td>Plant</td>
                                        <td>Sallary</td>
                                        <td>Join Date</td>
                                    </tr>

                                </table>
                            </td>
                        </tr>
                    </table>
                    <table height="150" width="100%">
                        <tr>
                            <td></td>
                        </tr>
                    </table>
                    <table height="" width="100%">
                        <tr>
                            <td align="center">hdkfjhadjshfkhkdshfjdh ljdhfkadshfads fhkja<br>
                                Adfhjkdshf  jdhfjhdskfhs
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </form>
</body>
</html>










Saturday, August 24, 2019

c# 7 tuples enable

1. Enable tuple
 Install System.Tuples from NuGet Package Manager



2. c#7  new tuple return


using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WebApplication8.Models;

namespace WebApplication8.Controllers
{
    public class home_Controller : ApiController
    {
        //type1 
        [HttpGet]
        public (int st, string msg, List<Employee> emp_list) Get_Data([FromUri] Employee d)
        {
            int status = 1;
            string message = "Success";
            List<Employee> employee_list = new List<Employee>() { new Employee { Address = "Agra", Emp_Name = "Rinkesh", Mobile = 987998, Srno = 1 }
            ,new Employee { Address="Agra",Emp_Name="Manish",Mobile=987998,Srno=2 }
            ,new Employee { Address="Sandeep",Emp_Name="Mathura",Mobile=5555,Srno=3}
            };

            return (st: status, msg: message, emp_list: employee_list);
        }
       
        //type2 
        [HttpGet]
        public (int st, string msg, List<Employee> emp_list) Get_Data([FromUri] Employee d)
        {
            int status = 1;
            string message = "Success";
            List<Employee> employee_list = new List<Employee>() { new Employee { Address = "Agra", Emp_Name = "Rinkesh", Mobile = 987998, Srno = 1 }
            ,new Employee { Address="Agra",Emp_Name="Manish",Mobile=987998,Srno=2 }
            ,new Employee { Address="Sandeep",Emp_Name="Mathura",Mobile=5555,Srno=3}
            };

            return (status, message, employee_list);
        }
    }
}


Sunday, August 11, 2019

Access control allowed or cors allow

1. Access-Control-Allow-Origin
2.Access-Control-Allow-Headers
3.Access-Control-Allow-Methods
all allowed globaly (in web.config)

  <system.webServer>

    <httpProtocol>
      <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
        <add name="Access-Control-Allow-Headers" value="Content-Type" />
        <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
      </customHeaders>
    </httpProtocol>


  </system.webServer>

Web.config connection


<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  https://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
  <connectionStrings>
    <!--<add name="cm_connection" connectionString="Data Source=AS-RIN;Initial Catalog=web_inc;User ID=sa;Password=mdts888" providerName="System.Data.SqlClient" />-->
    <add name="db_connection" connectionString="Data Source=OMG;Initial Catalog=test;User ID=sa;Password=mdts888" providerName="System.Data.SqlClient" />
    <!--<add name="cm_connection" connectionString="Data Source=sql5026.site4now.net;Initial Catalog=DB_A45CFD_rinkesh;User ID=DB_A45CFD_rinkesh_admin;Password=Rin@123456#" providerName="System.Data.SqlClient"/>-->
  </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.7.2" />
    <httpRuntime targetFramework="4.7.2" />
    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
      </namespaces>
    </pages>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
    </compilers>
  </system.codedom>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>

Saturday, August 10, 2019

Null Function in c# or null method in c#

        decimal? net_value(decimal? BASIC, decimal? WD, decimal? AB)
        {
            return BASIC - ((BASIC / WD) * AB);
        }

Thursday, August 8, 2019

HTTP Error 403.14 - Forbidden

The Web server is configured to not list the contents of this directory.


Solution Link 
1

2. 

3. Default Document must be Index.html or Default.aspx in IIS

When web application with sql server connection using sql client, working in visual studio but not working in localhost as in iis

Error:  The EXECUTE permission was denied on the object 'StoredProcedureTest1', database 'testDb1', schema 'dbo'.  C...