|
What Login control are you using?
The logical way would be to check if the user has logged in by say; storing their login value in a temp table or session and then check that on the event which logs a user in, if their login id already exists in a temp table then give message showing that they are already logged in.
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
thanks .netman for quick reply.
And i want to know ,
we can get session_end event if user logs out and we can updated the table details in this event.
but how to identify if user logs in and quits by closing the browser.
|
|
|
|
|
there are several ways to doing this. some are as follows
[1]==> you should have create array(table, array list) of all login users and stored in application object. when new user will login, then first what you have to do is check if the user id exist in application object. if yes then, restrict him. when user log out then delete entry from application object.
[2]==> you should make a boolean field in user master table in your database. when use login then set it true. and when user log off set it to false. make sure every login time that in database this field for that user set to false.
Regards,
Dilip Patel
Sr. Software Engineer (.Net).
|
|
|
|
|
thanks dilip for ur reply.
But how to identity things like
1) what if the user logs in and log out by closing browser close button.
2) What if the user logs in and leave behind.
thanks inadvance........
|
|
|
|
|
Do u got any solution . Plz let me know if u got it. I am also looking for the same.
cheers,
sekhar
|
|
|
|
|
If user doesn't log out before closing the browser, I don't think you have a choice but to wait for the session to expire. Except for...
I did write an application once where I needed to positively know that a user's browser window was still open. I added a heartbeat feature so that the server would know when the browser was closed. Consisted of an empty paged named heartbeat.aspx page that had a <META HTTP-EQUIV="refresh" content="30;URL=heartbeat.aspx/"> tag. This causes the page to get refreshed every 30 seconds. Then include the page in a 0x0 pixel frame on all your web app pages (using a master page). Now every page of your application will have a heartbeat. Just add code-behind to hearbeat.aspx to automatically log them out if you don't get a heartbeat for over 30 seconds (or whatever value you want).
Obviously not something you want to do on a high-traffic website but sounds like your application is low traffic - i.e 1 user at a time ![Wink | ;)](https://www.codeproject.com/script/Forums/Images/smiley_wink.gif)
|
|
|
|
|
Hi, i have database with 10 tables(for 10 countries). In my website, when the user selects the country in page1 and click on submit. the user navigates to page2 here i am showing the data of corresponding country in Gridview. It supports all the paging, editing, sorting etc.
i am using sqldatasource and for select,update, delete etc.
My problem is if i want to use this sqldatasource i need to give table name dynamically to this? how can i give this when i came from previous page to present page. how can i give this in select command?
my code is as follows . but getting error
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TAGDatabaseConnectionString4 %>"
SelectCommand="SELECT [Name], [LastorFirst] FROM [SGX_""<%Request.QueryString["Qstr"]%>""_SEED]"></asp:SqlDataSource>
G. Satish
modified on Thursday, September 4, 2008 5:28 AM
|
|
|
|
|
It seems like your database structure is not very good.
Surely it would have been better to have a lookup table with a list of the 10 countries in and then use the ID from that in another table to match the data.
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
Write code, don't use SQLDataSource which is nasty.
|
|
|
|
|
Is there no way to assign query to select command of sqldatasource dynamically ?????
G. Satish
|
|
|
|
|
assign country name in a session and use this value of session in sqldatasource where condition.
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
how should we convert the system date time format with "-" (dd-MMM-yyyy) to the format which we needed in the project i.e dd/MM/yyyy without making change in the system how shall we change in coding in asp .net 1.1 C#
|
|
|
|
|
try
Now.ToString("dd/MM/yyyy")
|
|
|
|
|
Check this link out
Convert date time
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
i am using the following code to open dropdown list while validating,but the
problem is that i am increasing size of DDL so that it looks like it is opened but by doing so it disturbs the formatting of all those controls which are below to it,so can you plz give a good code or suggestion for opening dropdown list on button click while validating.
<br />
<script language="javascript" type="text/javascript"><br />
<br />
<br />
function ddl_focus()<br />
{<br />
if(document.getElementById("<%=DropDownList1.ClientID %>").value=="0")<br />
{<br />
<br />
document.getElementById("<%=DropDownList1.ClientID %>").focus();<br />
open_ddl();<br />
}<br />
<br />
}<br />
<br />
function open_ddl()<br />
{<br />
document.getElementById("<%=DropDownList1.ClientID %>").size=10;<br />
}<br />
<br />
function close_ddl()<br />
{<br />
document.getElementById("<%=DropDownList1.ClientID %>").size=1;<br />
}<br />
<br />
<br />
</script><br />
<br />
<asp:scriptmanager id="ScriptManager1" runat="server" xmlns:asp="#unknown">
</asp:scriptmanager>
<br />
<table>
<tr>
<td style="width: 461px">
</td>
<td style="width: 239px">
</td>
<td style="width: 273px">
</td>
</tr>
<tr>
<td style="width: 461px">
<asp:dropdownlist id="DropDownList1" onmouseout="return close_ddl();" onmouseover="return open_ddl();" runat="server" width="125px" xmlns:asp="#unknown">
<asp:listitem value="0"><Select></asp:listitem>
<asp:listitem value="1">Agra</asp:listitem>
<asp:listitem value="2">delhi</asp:listitem>
<asp:listitem value="3">mumbai</asp:listitem>
<asp:listitem value="4">chennai</asp:listitem>
</asp:dropdownlist>
<asp:requiredfieldvalidator controltovalidate="DropDownList1" errormessage="RequiredFieldValidator" id="RequiredFieldValidator1" initialvalue="0" runat="server" setfocusonerror="True" xmlns:asp="#unknown">Plz select from ddl</asp:requiredfieldvalidator>
<asp:updatepanel id="UpdatePanel1" runat="server" updatemode="Conditional" xmlns:asp="#unknown">
<contenttemplate>
<asp:button id="Button1" onclick="Button1_Click" runat="server" text="Button" onclientclick="return ddl_focus();"></asp:button>
</contenttemplate>
</asp:updatepanel></td>
<td style="width: 239px">
</td>
<td style="width: 273px">
</td>
</tr>
</table>
Maniiiiiiiiiiiiiii
|
|
|
|
|
Hi I am developing an webpage.In my webpage there is a textbox.According to the textbox value,some details come on a button click.In button click event I've initialized OracleCommand object.My code is working for two times.But third time when I press the button,an error occurs saying object reference not set to an instance of an object.
I have done such codings thousands of time.But this time I am clueless why this is happening.Can any one help me out?
ARINDAM
|
|
|
|
|
Are you closing your OracleCommand.
Try putting in a break point so you find exactualy one which line your code is breaking.
|
|
|
|
|
I have put break point.It is showing the error in
string variablename=command.ExecuteScalar().Tostring().
While OracleCommand command=New OracleCommand() line is executing properly before the line at which error occurs.
Mysteriously for first two button click it works properly,but at third attempt it gives the error.
ARINDAM
|
|
|
|
|
can u plz mention that line where error occurs...
Maniiiiiiiiiiiiiii
|
|
|
|
|
If the query is returning null it could cause this error.
Check your query.
Also add a try Catch so the program doesn't stop running.
Hope this helps.
|
|
|
|
|
Hi all,
I m trying to create an custom shopping cart.
the scene is whenever an user adds any product into his shopping cart the quantity of the product which he has added should be reduced from the actual quantity of the product so as we may not get order more that the actual quantity. during the time the product remains in the users cart the the product quantity available for other user is shown less so as they may not order this product.
now the cart is set to expire in 15min if idle.
I m using cookies to create the cart. storing the product Id and quantity but the problem is how can I update the quantity if a person's cart expires.
any suggestion.
thanks & regards
Vijay V.
Yash Softech
|
|
|
|
|
You need to be able to check if the cookie has expired. When the cookie has expired move the quantity back into the table where the quantity of the product is.
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
hi,
i can read that but how can I trace that cookie is expired and how do I maintain that this much quantity is taken by someone or is in someones cart so not allow anyone else add to their cart?
how can I detect that this product is added in someones cart??
Vijay V.
Yash Softech
|
|
|
|
|
I think like Christian said below it may be better to use tables.
Imagine one of your tables in your database is the shopping cart and then store the details in there. You could put an expiry time on the product, so say 1 hour and after that it is then removed from the shopping cart.
Run some code in your application which checks the table for any items which have been in there longer than an hour, if so delete them and they will then be removed from the shopping cart.
If you think logically about how to do this with tables it will become quite easy.
feel free to ask more questions
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
thanks for valuable suggestions.
I think I must create an web schedular that will constantly check for product expiry time and if they are still there after that I mean checkout is not done I must remove that items from that.
thanks for the help guys.
Vijay V.
Yash Softech
|
|
|
|