|
nagendrathecoder wrote: After this, when i refreshes my "abc" user's page it shows all contents of "xyz" user and hence automatically expires session of "abc".
The session won't be expiring. It's your programming mistake. Can we have a look into your code ?
|
|
|
|
|
Sure, this is Login Page code.....
private void BtnGo_Click(object sender, System.EventArgs e)
{
Label1.Visible=false;
bool persistcookie=true;
if(ValidateUser(TextBox1.Text,TextBox2.Text))
{
//string globalstrConn="Provider=SQLOLEDB;Data Source=localhost;Initial Catalog=iMedia;Integrated Security=SSPI;";
Session["UserName"]=TextBox1.Text;
//This will store the username of the user in this session variable
// We can retrieve this username on different pages by using following code.
// string str=Convert.ToString(Session["UserName"]);
FormsAuthenticationTicket tkt;
string cookiestr;
HttpCookie ck;
tkt=new FormsAuthenticationTicket(1,TextBox1.Text,System.DateTime.Now,System.DateTime.Now.AddMinutes(Convert.ToInt32(ConfigurationSettings.AppSettings["timeout"])),persistcookie,"Your Custom Date");
cookiestr=FormsAuthentication.Encrypt(tkt);
ck=new HttpCookie(FormsAuthentication.FormsCookieName,cookiestr);
if(persistcookie)
ck.Expires =tkt.Expiration;
ck.Path =FormsAuthentication.FormsCookiePath;
Response.Cookies.Add(ck);
string strredirect;
strredirect=Request["ReturnUrl"];
if(strredirect==null)
strredirect="login.aspx";
Response.Redirect(ConfigurationSettings.AppSettings["defaultpage"],true);
}
else
{
Label1.Text="Invalid Credentials!";
Label1.Visible=true;
// Response.Redirect("login.aspx",true);
}
}
|
|
|
|
|
How to make a dropdownlist to be selected based on HTML anchor tag selection
|
|
|
|
|
You can access any control in code behind by adding runat='server'
Not sure how you want to select a dropdown based on a link tho. You probably want to do whatever you're doing in script, not code behind.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
How to access the HTML controls in code behind using asp.net with c#
|
|
|
|
|
Right click on the HTML control and choose "Run at server" or add Runat=Server attribute manually to your HTML controls tag.
|
|
|
|
|
You have make the html control a server control in order to access it on server side. Just make them runat=server and assign a ID to that control.
Apurva Kaushal
|
|
|
|
|
In a registration page after clicking submit button when we are pressing F5(refresh button) it again fires the submit button events(code).why?plz tell me the reason.and also how i can prevent this situation.
thanks in adv.
Sujit
|
|
|
|
|
Posted data will be kept in browsers cache, and when refresh is pressed, same data will be posted again which will invoke buttons event. To prevent this
1- After insertion to database, redirect to the same page. This will remove posted data from browser's cache
2 - Before insertion do a checking to verify that data is not duplicating.
|
|
|
|
|
thanx for yours help.
But i hv still 1 problem.after redirect the page Ispostback property fires again but i don't need this.bcz i hv some logic in Ispostback which will fires only once.
thn how can i avoid this Ispostback.
Sujit
|
|
|
|
|
|
Michael Sync wrote: What I did in my project is that if the user clicks the submit button, I disable this button during the processing time.
But after the process is over and in case you are there in the same page and then refresh button is clicked again the same problem will occur.
Apurva Kaushal
|
|
|
|
|
Apurva Kaushal wrote: But after the process is over and in case you are there in the same page and then refresh button is clicked again the same problem will occur.
No. I will be in the same page.. As the process is over, there won't be any data in the page or cache.
|
|
|
|
|
Michael Sync wrote: No. I will be in the same page.. As the process is over, there won't be any data in the page or cache.
But what I think is even after the process is over and you have not cleared the data exclusively it will be available in the page, isn't it?
Apurva Kaushal
|
|
|
|
|
Michael Sync wrote: As the process is over, there won't be any data in the page or cache.
I guess you will be disabling the button using JS, right ? Then after the postback(may be insertion), if user hits refresh, the previous event will fire again. I don't think that disabling button will prevent this.
|
|
|
|
|
That is what I too was expessing that unless it has been cleared explicitly it won't be cleared.
Apurva Kaushal
|
|
|
|
|
Hi,
i have placed the textboxes in the gridview
i have used the dropdownlist out of the grid,if i select am item from dropdown list 2 if my textbox in grid view will be filled and i have to enter an value in the another textbox and if i use tabkey it should multiply the values in the 2 textbox and display the value in the another textbox
can anyone help plz
thanks in anvance
|
|
|
|
|
can u give ur exact requrement or code.
coz frm ur post m nt getng how many rows r there in ur grid.
if three den it would b easy to do so..
|
|
|
|
|
i have a textbox name quantity in which the user will put the value,and another textbox as usage ....
i need to multiply values in these two table
and dispaly the result in third textbox
|
|
|
|
|
can i install .net framework in windows 98
|
|
|
|
|
How is this an ASP.NET question ?
What did google tell you?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hogan.smith wrote: Because they can never be used as a base class, some run-time optimizations can make calling sealed class members slightly faster.
then, maybe. Yes. Thanks. Anyway, I've been using the normal class since long time back.. I don't have any problem (including the performance issues) with those classes..
|
|
|
|
|
I am not an expert but I think we are unable to calculate the performance difference
Regards,
Hogan
|
|
|
|
|
Yes it will be bit tough to identify the performance problems. Do experiments with both methods, trace the results and check the execution timings. Also you can use any of the profilers available for .NET
|
|
|
|
|
Yes you are correct Navaneeth
|
|
|
|