---
title: "how to find user_type in asp.net?"  
description: "how to find user_type in asp.net?"  
author: "Anonymous User"  
published: 2014-11-10  
updated: 2014-11-11  
canonical: https://www.mindstick.com/forum/2553/how-to-find-user_type-in-asp-dot-net  
category: "asp.net"  
tags: ["c#", "sql server", "session"]  
reading_time: 1 minute  

---

# how to find user_type in asp.net?

I have [login](https://www.mindstick.com/articles/12852/styles-login-form-in-android) [page](https://www.mindstick.com/articles/13031/why-to-make-a-wikipedia-page) with [users](https://www.mindstick.com/news/2244/issue-preventing-users-from-accessing-facebook-s-social-networking-platforms-has-been-resolved) having 3 [user](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) typs. from login im capturig user id and password. but i want to [check](https://yourviews.mindstick.com/story/2248/never-forget-to-check-these-specifications-before-buying-a-mobile-phone) user_type [field](https://www.mindstick.com/forum/160867/does-mindstick-provide-training-for-field-marketing) and depending on that [redirect](https://www.mindstick.com/forum/2005/radio-button-redirect) to diferent pages after login. please [advice](https://yourviews.mindstick.com/view/50528/filament-advice-5-things-to-consider-before-you-buy-a-filament) me

## Replies

### Reply by Anonymous User

You have to do something like this if you want to read from DB.

```
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConString"].ConnectionString);    con.Open();    SqlCommand cmd = new SqlCommand("SELECT User_Type FROM [User] WHERE User_Id =@userid and
User_Password=@password", con);    cmd.Parameters.AddWithValue("@userid",Convert.ToInt32(txtUserName.Text));    cmd.Parameters.AddWithValue("@password",txtPassword.Text);    var reader = cmd.ExecuteReader();    if (reader.HasRows)    {    reader.Read();    string userType =reader.GetString(0);        Session["USER_ID"]= txtUserName.Text;        Response.Redirect("Default.aspx");    }    else    {        Response.Write("Login Failed");    } 
```


---

Original Source: https://www.mindstick.com/forum/2553/how-to-find-user_type-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
