# 튜토리얼 - ASP.NET

.NET 개발환경에서 팝빌 SDK를 추가하고, 사업자등록상태 대량조회 (CheckCorpNums) API를 호출하는 기본 과정을 단계별로 따라 해볼 수 있도록 구성된 가이드 입니다.

## 1. POPBiLL SDK 추가

① 팝빌 연동자료실에서 ASP.NET SDK 예제코드 다운로드 후 압축을 해제합니다.

② 다운받은 SDK 예제코드의 Linkhub/, Popbill/ 폴더를 SDK를 적용할 프로젝트 경로에 복사하고, Linkhub.csproj, Popbill.csproj를 각각 기존 프로젝트로 추가합니다.

![](https://developers.popbill.com/images/guide/getting-started/image-tutorial-append-sdk-dotnet-asp-01.jpg)

③ Popbill 프로젝트를 적용할 프로젝트의 참조로 추가합니다.

![](https://developers.popbill.com/images/guide/getting-started/image-tutorial-append-sdk-dotnet-asp-02.jpg)

## 2. CheckCorpNums 기능 구현

Web Form을 추가하여 checkCorpNums.aspx를 생성하여 응답코드, 메시지 확인 페이지를 추가하고, checkCorpNums.aspx.cs 파일의 Page\_Load 이벤트에 함수 호출 코드를 추가합니다.

checkCorpNums.aspx

```csharp
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="checkCorpNums.aspx.cs" Inherits="Popbill.Closedown.Example.checkCorpNums" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
  <title>Popbill CloseDown</title>
</head>
<body>
  <div>
  <p>Response</p>
  <br/>
    <fieldset>
    <legend>사업자등록상태조회 - 대량</legend>
    <% if (!String.IsNullOrEmpty(code)) { %>
      <ul>
        <li>Response.code : <%= code %> </li>
        <li>Response.message : <%= message %></li>
      </ul>
    <% } else { %>
      <p>> state (휴폐업상태) : null-알수없음, 0-등록되지 않은 사업자번호, 1-사업중, 2-폐업, 3-휴업</p>
      <p>> type (사업자 과세유형) : null-알수없음, 1-일반과세자, 2-면세사업자, 3-간이과세자, 4-비영리법인, 국가기관</p>
      <% foreach (Popbill.Closedown.CorpState result in corpStateList)
      { %>
      <fieldset>
        <ul>
          <li>corpNum (사업자번호) : <%= result.corpNum %></li>
          <li>type (사업자 과세유형) : <%= result.type %></li>
          <li>state (휴폐업상태) : <%= result.state %></li>
          <li>stateDate (휴폐업일자) : <%= result.stateDate %></li>
          <li>typeDate (과세유형 전환일자) : <%= result.typeDate %></li>
          <li>checkDate (국세청 확인일자) : <%= result.checkDate %></li>
        </ul>
      </fieldset>
    <% } %>
    <% } %>
    </fieldset>
  </div>
</body>
</html>
```

checkCorpNums.aspx.cs

```csharp
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;


namespace Popbill.Closedown.Example
{
    public partial class checkCorpNums : System.Web.UI.Page
    {
        public String code;
        public String message;
        public List<CorpState> corpStateList;


        protected void Page_Load(object sender, EventArgs e)
        {
            // 팝빌회원 사업자번호, '-' 제외 10자리
            String testCorpNum = "1234567890";


            // 조회할 사업자번호 배열, 최대 1,000건
            List<String> CorpNumList = new List<String>();


            CorpNumList.Add("1234567890");
            CorpNumList.Add("1231212312");
            CorpNumList.Add("6798700433");


            try
            {
                corpStateList = Global.closedownService.checkCorpNums(testCorpNum, CorpNumList);
            }
            catch (PopbillException ex)
            {
                code = ex.code.ToString();
                message = ex.Message;
            }
        }
    }
}
```

## 3. API 응답결과 확인

API 호출 응답결과는 다음과 같습니다.

| 구분 | 응답                                                                                            |
| -- | --------------------------------------------------------------------------------------------- |
| 성공 | state(휴폐업상태) : 0 \~ 3 (1자리 문자열)                                                               |
| 실패 | code : 오류코드 (8자리 음의 정수) [\[오류코드\]](https://developers.popbill.com/error-code) message : 오류메시지 |
