Click here to Skip to main content
15,890,512 members
Home / Discussions / C#
   

C#

 
AnswerRe: Converting Bits value into integer Pin
musefan11-May-09 21:57
musefan11-May-09 21:57 
AnswerRe: Converting Bits value into integer Pin
OriginalGriff11-May-09 22:03
mveOriginalGriff11-May-09 22:03 
AnswerRe: Converting Bits value into integer Pin
Luc Pattyn12-May-09 0:34
sitebuilderLuc Pattyn12-May-09 0:34 
Question[Message Deleted] Pin
aastudent11-May-09 21:25
aastudent11-May-09 21:25 
AnswerRe: Publish with office interop Pin
Simon P Stevens11-May-09 21:53
Simon P Stevens11-May-09 21:53 
GeneralRe: Publish with office interop Pin
aastudent12-May-09 4:33
aastudent12-May-09 4:33 
GeneralRe: Publish with office interop Pin
Simon P Stevens13-May-09 0:59
Simon P Stevens13-May-09 0:59 
QuestionHow to use session ?? Pin
lsh486love11-May-09 21:23
lsh486love11-May-09 21:23 
I'm making a login page with ASP.NET with C#.

and I know that it needs to use Session for saving information of loggined user.

so I used Session like this on "login.aspx.cs" with Login View Control.


[login.aspx.cs]



// Database query.

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Join"].ConnectionString);
SqlCommand cmd = new SqlCommand("SELECT * From User WHERE id = @ID", con);
cmd.Parameters.AddWithValue("@ID", ((TextBox)LoginView1.FindControl("TextBox1")).Text);

string name = rd["name"].ToString();
string pw = rd["password"].ToString();
string pw1 = ((TextBox)LoginView1.FindControl("TextBox2")).Text;
string id = rd["id"].ToString();

// Save to Session variables. There are a lot of components about Session. Keys, Item, Add,
//and so on..

Session["memberid"] = id;
Session["membername"] = name;

if ((string.Equals(pw, pw1)) == true)
{
FormsAuthentication.RedirectFromLoginPage(name, false);
}

....
And I made codes like this whether lggined user is same with Writer on board or not.


[Board.aspx]


public static bool IsWriter(string pdsId, string Writer)
{

string sql = "Select id From t_Pds Where boardId = @boardId And writer = @writer";
SqlCommand cmd = new SqlCommand(sql, DbConn.GetConn());

cmd.Parameters.AddWithValue("@boardId", pdsId);
cmd.Parameters.AddWithValue("@writer", Writer);
cmd.Connection.Open();
string result = (string)cmd.ExecuteScalar(); // result = ID of writer value.
cmd.Connection.Close();


// I can't use Session. When I use "Session", there are no components of Session.
// There are only two values of Session. ( SessionPageStatePersister , SessionParameter)

if (Session["memberid"] == result) //ERROR.
{
return true;
}
else
return false;

}


}
Questiongetting directory list in creation date order Pin
JacquesBrits11-May-09 21:14
JacquesBrits11-May-09 21:14 
AnswerRe: getting directory list in creation date order Pin
tim_gunning12-May-09 1:14
tim_gunning12-May-09 1:14 
Questionconvert postscript to pdf Pin
tauras8111-May-09 20:57
tauras8111-May-09 20:57 
AnswerRe: convert postscript to pdf Pin
LesF23-Nov-09 22:32
LesF23-Nov-09 22:32 
Questioncalender Pin
smithasuryanarayanan11-May-09 20:42
smithasuryanarayanan11-May-09 20:42 
AnswerRe: calender Pin
Henry Minute11-May-09 21:06
Henry Minute11-May-09 21:06 
Questionhow to receive a frame in Serial port by FiFo buffer Pin
hamed_farasat11-May-09 20:16
hamed_farasat11-May-09 20:16 
QuestionAdding Authentication in C# client for gSOAP C++ webservices........ Pin
King Julien11-May-09 19:46
King Julien11-May-09 19:46 
QuestionDataGridView CellPainting (some cells only) Pin
John Jak11-May-09 19:36
John Jak11-May-09 19:36 
QuestionHow can I get the reference of PDF file opened in Internet Explorer using c#? Pin
svt gdwl11-May-09 19:26
svt gdwl11-May-09 19:26 
Questionpassing parameters between two application Pin
imannasr8811-May-09 19:23
imannasr8811-May-09 19:23 
AnswerRe: passing parameters between two application Pin
dan!sh 11-May-09 19:36
professional dan!sh 11-May-09 19:36 
GeneralRe: passing parameters between two application Pin
imannasr8812-May-09 0:35
imannasr8812-May-09 0:35 
QuestionGet time zones in windows mobile Pin
vijaywithu11-May-09 19:08
vijaywithu11-May-09 19:08 
Questionhow to nudge a picture in excel sheet using c# Pin
tofa11111-May-09 18:14
tofa11111-May-09 18:14 
AnswerRe: how to nudge a picture in excel sheet using c# Pin
dan!sh 11-May-09 18:22
professional dan!sh 11-May-09 18:22 
GeneralRe: how to nudge a picture in excel sheet using c# Pin
tofa11111-May-09 18:28
tofa11111-May-09 18:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.