Click here to Skip to main content
15,912,897 members
Home / Discussions / C#
   

C#

 
QuestionChange Size of control on Form Maximize event Pin
hitesh sojitra28-Sep-08 21:27
hitesh sojitra28-Sep-08 21:27 
AnswerRe: Change Size of control on Form Maximize event Pin
Giorgi Dalakishvili28-Sep-08 21:52
mentorGiorgi Dalakishvili28-Sep-08 21:52 
Questioni have a problem in Croping an image? Pin
maifs28-Sep-08 21:12
maifs28-Sep-08 21:12 
AnswerRe: i have a problem in Croping an image? Pin
Giorgi Dalakishvili28-Sep-08 21:55
mentorGiorgi Dalakishvili28-Sep-08 21:55 
AnswerRe: i have a problem in Croping an image? Pin
Mark Salsbery29-Sep-08 7:37
Mark Salsbery29-Sep-08 7:37 
QuestionHow to discard Dialog "Page x of document" shown after printing each page of a multi page document? Pin
karimy.reza28-Sep-08 20:56
karimy.reza28-Sep-08 20:56 
QuestionRememberMe option to remember only username using asp:login? Pin
.NetRams28-Sep-08 20:26
.NetRams28-Sep-08 20:26 
AnswerRe: RememberMe option to remember only username using asp:login? Pin
John Ad28-Sep-08 20:40
John Ad28-Sep-08 20:40 
Hi Rams,

Refer to the following code that uses a CheckBox and gives the flexibility to the user to save the username:

<br />
<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
if (!Page.IsPostBack)<br />
{<br />
CheckBox cek = (CheckBox)Login1.FindControl("RememberMe");<br />
if (Request.Cookies["username"] == null Request.Cookies["username"].Value.ToString().Trim() == "")<br />
{<br />
cek.Checked = false;<br />
}<br />
else<br />
{<br />
<br />
Login1.UserName = Request.Cookies["username"].Value.ToString();<br />
}<br />
}<br />
}<br />
<br />
<br />
protected void Login1_LoggingIn(object sender, LoginCancelEventArgs e)<br />
{<br />
CheckBox cek = (CheckBox)Login1.FindControl("RememberMe");<br />
if (cek.Checked == true)<br />
{<br />
HttpCookie cookie = new HttpCookie("username");<br />
cookie.Value = Login1.UserName;<br />
<br />
cookie.Expires = DateTime.Now.AddDays(1);//cookie Expires<br />
HttpContext.Current.Response.AppendCookie(cookie);<br />
}<br />
else {<br />
HttpContext.Current.Response.Cookies.Remove("username");<br />
}<br />
cek.Checked = false;<br />
}<br />
<br />



//--- another way

<br />
<br />
protected void Page_Load(object sender, EventArgs e)<br />
<br />
{<br />
<br />
if (Request.Cookies["MyCookie"] != null)<br />
<br />
{<br />
<br />
TextBox pass = (TextBox)Login1.FindControl("Password"); pass.Attributes.Add("value", Request.Cookies["MyCookie"]["password"]); Login1.UserName = Request.Cookies["MyCookie"]["username"];<br />
<br />
}<br />
<br />
}<br />
<br />
protected void Login1_LoggedIn(object sender, EventArgs e)<br />
<br />
{ <br />
<br />
HttpCookie cookie1 = new HttpCookie("MyCookie"); <br />
<br />
cookie1.Values.Add("username", Login1.UserName);<br />
<br />
cookie1.Values.Add("password", Login1.Password); <br />
<br />
cookie1.Expires = DateTime.Now.AddDays(1);//cookie Expires HttpContext.Current.Response.AppendCookie(cookie1);<br />
<br />
}<br />
<br />


I hope this would be helpful. For more information on this refer to the following links:

Overview of Forms Authentication[^]

How to implement simple Form Authentication[^]

John Adams
ComponentOne LLC.
www.componentone.com

GeneralRe: RememberMe option to remember only username using asp:login? Pin
.NetRams28-Sep-08 22:42
.NetRams28-Sep-08 22:42 
GeneralRe: RememberMe option to remember only username using asp:login? Pin
leppie28-Sep-08 23:20
leppie28-Sep-08 23:20 
QuestionChange ClassName in c# Pin
RYU^^28-Sep-08 19:08
RYU^^28-Sep-08 19:08 
AnswerRe: Change ClassName in c# Pin
leppie28-Sep-08 23:19
leppie28-Sep-08 23:19 
GeneralRe: Change ClassName in c# Pin
RYU^^29-Sep-08 12:26
RYU^^29-Sep-08 12:26 
GeneralRe: Change ClassName in c# Pin
DrWatsonCoding19-Oct-10 4:20
DrWatsonCoding19-Oct-10 4:20 
QuestionConvert Class file to a DLL file Pin
HatakeKaKaShi28-Sep-08 16:14
HatakeKaKaShi28-Sep-08 16:14 
AnswerRe: Convert Class file to a DLL file Pin
N a v a n e e t h28-Sep-08 17:22
N a v a n e e t h28-Sep-08 17:22 
GeneralRe: Convert Class file to a DLL file Pin
HatakeKaKaShi28-Sep-08 17:32
HatakeKaKaShi28-Sep-08 17:32 
GeneralRe: Convert Class file to a DLL file Pin
N a v a n e e t h28-Sep-08 17:36
N a v a n e e t h28-Sep-08 17:36 
GeneralRe: Convert Class file to a DLL file Pin
HatakeKaKaShi28-Sep-08 17:46
HatakeKaKaShi28-Sep-08 17:46 
GeneralRe: Convert Class file to a DLL file Pin
N a v a n e e t h28-Sep-08 17:54
N a v a n e e t h28-Sep-08 17:54 
GeneralRe: Convert Class file to a DLL file Pin
HatakeKaKaShi28-Sep-08 21:34
HatakeKaKaShi28-Sep-08 21:34 
GeneralRe: Convert Class file to a DLL file Pin
Guffa28-Sep-08 22:23
Guffa28-Sep-08 22:23 
QuestionHTTP request on network Pin
mihksoft28-Sep-08 8:49
mihksoft28-Sep-08 8:49 
AnswerRe: HTTP request on network Pin
Devin Doucette28-Sep-08 15:08
Devin Doucette28-Sep-08 15:08 
QuestionSending/Recieving Byte(s) To/From USB Port Pin
Vahid Keykhaey28-Sep-08 8:32
Vahid Keykhaey28-Sep-08 8:32 

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.