> For the complete documentation index, see [llms.txt](https://dwp-sso.gitbook.io/developers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dwp-sso.gitbook.io/developers/development/asp-net-mvc/undefined-1.md).

# 세션 탈취 검사하기

Agent에서 AuthCheck 클래스를 이용해 인증 체크를 하고 그 결과가 [AuthStatus.SSOSuccess](/developers/undefined-1/authstatus.md#ssosuccess-0) 일 때 사용자의 세션 탈취 여부를 조사하는 메서드를 실행합니다.&#x20;

이 메서드는 필요한 페이지에서만 호출합니다. Json data를 이용하는 로직이 있으므로 Ajax의 결과 페이지에서는 사용하지 않아야 합니다.

\[HomeController.cs 의 Index 메서드 중 일부]

```csharp
public ActionResult Index()
{
	try
	{
		HomeIndexViewModel model = new HomeIndexViewModel();
		AuthCheck authCheck = new AuthCheck(Request, Response);
		AuthStatus status = authCheck.CheckLogon();

		if (status == AuthStatus.SSOSuccess)
		{
			authCheck.CheckHijacking();
		}
		return View(model);
	}
	catch(AgentException agentException)
	{
		HomeIndexViewModel errModel = new HomeIndexViewModel();
		errModel.ErrorCode = agentException.ExceptionCode.ToString();
		return View(errModel);				
	}			
}
```
