Wednesday, March 30, 2022

ASP.NET connection string in web.config in appsetting section Configuration.cs

 The file will be stored in App_Code/Common

web.config file

<appSettings>

    <add key="ConnectionString" value="Server=DESKTOP-EUCFT2Q; Database=Test; UID=sa; PWD=password;Min Pool Size=20; Max Pool Size=200"/>


</appSettings>


------------------------------------------


using System;

using System.Collections.Generic;

using System.Text;


//Add reference to System.Web if not yet referenced

using System.Web;

using System.Web.Configuration;


namespace Luminious.Connection

{

    public abstract class Configuration

    {

        public static String ConnectionString

        {

            get

            {

                return WebConfigurationManager.AppSettings["ConnectionString"];

            }

        }

      

    }

}


ASP.NET SQLHelper class for sql related query SQLHelper.cs

 File will be stored in App_Code/Common/


https://drive.google.com/file/d/1018Z7JHxlfQigLIdB0REfpdZR4L0qLMh/view?usp=sharing

Tuesday, March 29, 2022

ASP.NET Utility for website Utility.cs

 It will be stored in Utility folder(App_Code)


https://drive.google.com/file/d/1KnwG6FRAlQ-WpyqqgOWLiIPNiXo5hsFV/view?usp=sharing


ASP.NET Excel file ExcelHelper.cs

It will be stored in utility folder(App_Code).

 using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Data;

using System.IO;

using System.Text;


/// <summary>

/// Summary description for ExcelHelper

/// </summary>


public class ExcelHelper

{

    //Row limits older Excel version per sheet

        const int rowLimit = 65000;

ASP.NET encryption Encryption.cs

It will store in QueryString folder(App_Code Folder).

 using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Security.Cryptography;

using System.IO;

using System.Text;


/// <summary>

/// Summary description for Encryption

/// </summary>

public static class Encryption

Friday, March 25, 2022

Connection string in ASP.NET and App setting key and value

 web.config connection string

<configuration>

<connectionStrings>

<add name="connectionString" connectionString="data source =.\sqlexpress;initial catalog=aggregate;user id=sa1;password=sa;" />

or

<add name="CmsConn" connectionString="Data Source=.;Initial Catalog=PMSNoChange;User Id=sa;Password=19102022" />


or

<add name="CmsConn" connectionString="Data Source=10.15.251.256;Initial Catalog=PMSNoChange;User Id=sa;Password=19102022" /> (IP address of server)

</connectionStrings>

</configuration>


or 


web.config connection string

<configuration>

<connectionStrings>

<add name="connectionString" connectionString="initial catalog=aggregate;user=sa1;password=sa;data source=." />

</connectionStrings>

</configuration>


<appSettings>

    <add key="ConnectionString" value="Server=DESKTOP-EUCFT2Q\SQLDEV; Database=ESDM_NIELIT_NEW; UID=sa; PWD=25032022;Min Pool Size=20; Max Pool Size=200"/>

    <!--<add key="ConnectionString" value="Server=10.249.164.100; Database=ESDM_NIELIT_NEW; UID=esdm-skill; PWD=Esdm@321;Min Pool Size=20; Max Pool Size=200" />-->

    <add key="nsdlgateway" value="http://192.168.1.70/ESDM/PaymentSucessful.aspx" />

    <add key="MerchantId" value=" MYSITE " />

</appSettings>




using System;

using System.Collections.Generic;

using System.Text;


//Add reference to System.Web if not yet referenced

using System.Web;

using System.Web.Configuration;


namespace CompanyName.Connection

{

    public abstract class Configuration

    {

        public static String ConnectionString

        {

            get

            {

                return WebConfigurationManager.AppSettings["ConnectionString"];

            }

        }


       

    }

}


Error HTTP 500.23 Internal server error in asp.net website (validation) - hanlders - Web.config

An asp.net setting has been detected that does not apply in integrated managed pipeline mode.

 Add this code to web.server


<system.webServer>


    <validation validateIntegratedModeConfiguration="false"/>

</system.webServer>

How to resolve SSL related error in asp.net website - https web.config

The site can't provide secure connection.

Change HTTPS to http

  </system.webServer>

 <rules>

        <rule name="Redirect to HtTP" stopProcessing="true">

          <match url="(.*)" />

          <conditions>

            <add input="{HTTP}" pattern="^OFF$" />

          </conditions>

          <action type="Redirect" url="http://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />

        </rule>

      </rules>

    </rewrite>

  </system.webServer>


reference:- https://www.c-sharpcorner.com/article/redirecting-http-request-to-https-using-web-config-file3/

Thursday, March 17, 2022

What is the use of putty

 Putty is use for executing command.

PHP frameworks and editor

 Codeigniter

Larval



>Also we have to download composer from getcomposer.org

> Click on download 

>In command prompt we have to write composer.exe



Editor for PHP Sublime text











Wednesday, March 16, 2022

How to install PHP in visual studio?

 https://www.youtube.com/watch?v=begPcGfAwzY


https://www.youtube.com/watch?v=paJcrlqjArQ

PHP mvc website example

 https://github.com/gmaccario/simple-mvc-php-framework/blob/master/views/home.php

Excel Insert cells delete cells and other

> Ctrl + Shift + down

> Right click on cell

> Click on Insert (cut cells)

> Click on shift cell right

---------------------------------------

if you don't see the cells in excel

>Click on view and than click on normal(screenshot below)


How to freeze top row in excel?

>Click on view

>click on freeze panes>

>Click on freeze top row







Friday, March 11, 2022

How to scan Page in Android phone with Google Scanner - Scan using mobile

 > Click on Google drive

> Click on Add

> Click on Scan

>You can also change color (black and white or color) and Save the file.

>Enter the name of file.

>If File shows waiting for wifi, than load the menu from up side and click on resume on file.

>File will be saved in Google Drive and you can share.


-------------------**************-------------------------


Or you can use Photo scan by google photos(download from play store)

Thursday, March 10, 2022

Web service like API Controller class in asp.net C#

 using System;

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

namespace WebAPIKeyAuth.Controllers
{
    public class EmployeeController : ApiController
    {
        [HttpGet]
        [Route("api/employees")]
        public IHttpActionResult GetEmployees()
        {
            List employeeList = new List()
            {
                new Employee() {Id = 1, Name="Employee1", Designation="Manager" },
                 new Employee() {Id = 2, Name="Employee2", Designation="Supervisor" }
            };
            return Ok(employeeList);
        }
        [HttpPost]
        [Route("api/employee/add")]
        public IHttpActionResult AddEmployee([FromBody]Employee employee)
        {
            return Ok("Employee is added in the system, Employee: " + "ID: " + employee.Id.ToString() + ", Name: " + employee.Name);
        }
    }
}
reference :- https://www.codingpointer.com/asp-dot-net-tutorial/rest-web-api-key-authentication

Sum function with Group By clause in SQL Server and without count with group by clause

SELECT SUM(Amount), AgentCode FROM Agent

GROUP BY AgentCode



Table structure(screenshot below)


---------------------------

without count in group by(use group by and select, same column)

SELECT Amount from Agent GROUP BY Amount


Reference:- https://www.w3resource.com/sql/aggregate-functions/sum-with-group-by.php



Online compiler for SQL query

 www.mycompiler.io

How to enable dark mode in MS office (MS Excel)

 > First click on File

> Click on Option (screenshot given below)


> Than click on General

> Than click on Office Theme (Dark Grey) --- (Screenshot given below)


Reference:- https://www.howtogeek.com/360470/how-to-enable-dark-mode-in-microsoft-office/

Saturday, March 5, 2022

What is MVC in ASP.NET

 https://www.tutorialsteacher.com/mvc

How to change datatype of single or multiple column(s) in table in SQL server

For single column

 ALTER TABLE table_name

ALTER COLUMN column_name datatype;


----------------------------------------------------------------
For multiple columns

ALTER TABLE MST_TP_REGISTRATION ALTER COLUMN TP_Acct_Bene_Name VARCHAR(100) 

ALTER TABLE MST_TP_REGISTRATION ALTER COLUMN TP_Acct_Bene_Name_PAN VARCHAR(100)

What is XML

 XML is a extensible markup language. It is a markup language like HTML.  We can save it into .xml extension.


Example:-

<?xml version="1.0" encoding="UTF-8" ?>

<note>

    <to>

        Yash

    </to>

    <from>

        naveen

    </from>

</note>

What is ERP

 ERP is a Enterprise resource planning.

It is a system or software used for planning, manufacturing, financial and other process of an organization.

SQL Lite in asp.net


using system.Data.SQLite;


SQLiteconnection con = new SQLiteConnection(@"Data Source = C:/test.db");

How to save images of excel File

In excel, Click on save file as web page and images will be stored separately in folder.



 

What is JQuery

 JQuery is a light weight, write less, do more javascript library.

Table tag in HTML

 <table border="1">

</table>

Marquee tag in HTML

 <div style="height: 500px">

    <marquee height="500" direction="down">

        Test

    </marquee>

</div>

Table data nth hide column

 <style>

    td: nth-child(2)---------------- column second

    {

        display: none

    }

</style>


reference:- www.w3schools.com/cssref

Table Data nth background color

 <style>

    td: nth-child(2)------------------column second

    {background-color: red;}

</style>


reference:- w3schools.com/cssref/