|
Hi,
Iam developing a intranet site and want to track the users, iam using session for this purpose, Iam using windows authentication mode so there is no login form here..
when a user clicks the url for the first time a new session is created and at that time Iam adding a entry in a table(say :Users) with username and logintime and sessionid etc.,
Below is the logic Iam using in form_load event of Default.aspx
If session("user") is nothing then
---create new session (at this point Iam adding a entry in table(users))
Else
--- use the same session and continue the work.
End if
When i check the users in the table some entries are created with same userid and same sessinids with different login time, how this is possible...
I just want to know who is logged in and what time...
could someone explain, why this is happening..
Regards
Imtiaz A.K
|
|
|
|
|
If your using InProc session state then the session may be dropped due to memory pressure and then recreated when the user next requests a page. ASP.Net will use a valid session id from cookie if the client provides one.
This could also happen if the web application is running with more than one process (web garden/web farm).
To avoid it, use an external session state server (such as SqlServer or State Server).
|
|
|
|
|
This could also happen if the web application is running with more than one process (web garden/web farm).
what does this mean could you please elaborate the solution...
Thanks...
Imtiaz A.K
|
|
|
|
|
It means that of your using inproc session state the session data is stored per process. Having more than one asp.net worker process will cause this type of session duplication.
When you have two or more worker processes on a single server its called a web garden. If you have more than one server its a web farm.
|
|
|
|
|
Hi,
I am getting an arror like this.
"The timeout period elapsed prior to completion of the operation or the server is not responding."
(here i am retrieving more than 60000 records)
Any Idea?
Known is a drop, unknown is an ocean
|
|
|
|
|
|
Wow Wat a logic?
Thanks
Keep posting this kind of answers
Known is a drop, unknown is an ocean
|
|
|
|
|
Did you bother to go through any of the link?
This is a very common problem and have lots of answers on google.
As simply by the exception. Timeout is getting expired. So there are two ways..
First, increase the CommandTimeout say 120 then try,
Another thing, look into it why it is taking so much time.
One more thing, As I believe you would not be displaying this much record in the front end so better do some paging etc.. at DB level.
One last thing, before posting any question TRY GOOGLE
|
|
|
|
|
k, thanks
But i tried google. before posting question here, i always do it.
But that didnt work . i tried commandout method also. but no use.
This is my stored proc
CREATE procedure [dbo].[C_ToRemoveLocalDataDuplicateRecords]
as
begin transaction
--Insert the duplicate record to duplicate table
insert into tblLocalDataDuplicate ([AddressPK],[SlNo], [CategoryID],[ProjectID],
[WebUrl],[Name],[StreetAddress],[City],[State],[ZipCode],[Telephone],[SecondaryPhone],
[EmailID],[EnteredDate],[UpdatedDate],[UserId])
SELECT distinct(T1.[AddressPK]),T1.[SlNo],T1.[CategoryID],T1.[ProjectID],
T1.[WebUrl],T1.[Name],T1.[StreetAddress],T1.[City],T1.[State],T1.[ZipCode],T1.[Telephone],T1.[SecondaryPhone],
T1.[EmailID],T1.[EnteredDate],T1.[UpdatedDate],T1.[UserId]
FROM tblLocalData T1, tblLocalData T2
where T1.name = T2.name and T1.streetaddress =T2.streetaddress
and T1.city =T2.city and T1.state =T2.state and T1.zipcode =T2.zipcode and T1.telephone =T2.telephone and T1.SecondaryPhone =T2.SecondaryPhone
and T1.addresspk < T2.addresspk order BY name,streetaddress, city, state, zipcode,telephone,T1.addresspk
--Delete the duplicate records
delete T1
FROM tblLocalData T1, tblLocalData T2
where T1.name = T2.name and T1.streetaddress =T2.streetaddress
and T1.city =T2.city and T1.state =T2.state and T1.zipcode =T2.zipcode and T1.telephone =T2.telephone and T1.SecondaryPhone =T2.SecondaryPhone
and T1.addresspk < T2.addresspk
if (@@error > 0)
rollback transaction
else
commit transaction
i am not displaying any data in gvw instead of that i am displaying it in csv file.
Here i am checking for duplicate records (total records upto 60,000).
Known is a drop, unknown is an ocean
|
|
|
|
|
Hi Sree,
if you want to optimise, need more help then you put it in datatbase section.
You also can have some sql job that will run after certain period to remove th duplicate records. So this will be an independent process and will reduct the work that you are doing in your SProc here.
One thing, I dont know how are you generating the CSV file, but in one of my project we used SSRS that enables us to export the data in several format like csv,pdf etc so you can also use that.
|
|
|
|
|
Thanks Brij
Known is a drop, unknown is an ocean
|
|
|
|
|
To me, the query is not well optimized and I think, you should optimize your stored procedure.
I have optimized the query and it may work for you: -
WITH DuplicateRecords(Name,StreetAddress,City,State,ZipCode,Telephone,SecondaryPhone,AddressPK) AS
(
SELECT T1.[Name],T1.[StreetAddress],T1.[City],T1.[State],T1.[ZipCode],T1.[Telephone],T1.[SecondaryPhone],COUNT(*) AS 'NoOfEntries',min(AddressPK) as 'AddressPK' from #Test1
GROUP BY T1.[Name],T1.[StreetAddress],T1.[City],T1.[State],T1.[ZipCode],T1.[Telephone],T1.[SecondaryPhone] HAVING COUNT(*) > 1
ORDER BY T1.[Name],T1.[StreetAddress],T1.[City],T1.[State],T1.[ZipCode],T1.[Telephone],T1.[SecondaryPhone]
)
INSERT INTO tblLocalDataDuplicate ([AddressPK],[SlNo], [CategoryID],[ProjectID],
[WebUrl],[Name],[StreetAddress],[City],[State],[ZipCode],[Telephone],[SecondaryPhone],
[EmailID],[EnteredDate],[UpdatedDate],[UserId])
SELECT T1.[AddressPK],T1.[SlNo],T1.[CategoryID],T1.[ProjectID],T1.[WebUrl],T1.[Name],T1.[StreetAddress],T1.[City],T1.[State],T1.[ZipCode],T1.[Telephone],T1.[SecondaryPhone],T1.[EmailID],T1.[EnteredDate],T1.[UpdatedDate],T1.[UserId]
FROM tblLocalData T1 INNER JOIN DuplicateRecords T2
ON T1.addresspk = T2.AddressPK
--Delete the duplicate records
DELETE tblLocalData
WHERE addresspk IN(SELECT AddressPK FROM DuplicateRecords)
please let me know when you are done.
I hope this may help you.
Regards,
Suresh Dayma
Everything Is Possible!
|
|
|
|
|
Since you have already tried few options, not sure if you have done this too, but it looks like response time got elapsed. One of the ways to increase it is using httpRuntime element in the Web.Config file.
You need to add something like:
<httpRuntime
executionTimeout = "number"
maxRequestLength = "number" />
For more details on it, read here: http://msdn.microsoft.com/en-us/library/e1f13641.aspx[^]
|
|
|
|
|
I want to be notified of any 404 (Page not found) errors via e-mail. I'm using Windows Server 2008, ASP.NET 3.5, C# code-behind, etc.
I have a page, that displays just fine upon 404 error, with the following in code-behind Page_Load():
System.Net.Mail.MailAddress from = new System.Net.Mail.MailAddress("from@domain.com");
System.Net.Mail.MailAddress to = new System.Net.Mail.MailAddress("to@domain.com");
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(from,to);
message.Subject = "404 - File or directory not found";
message.Body = String.Format(
"The following page generated a 404 error:\n{0}\n",
Convert.ToString(Request.QueryString["aspxerrorpath"]) );
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("mail.domain.com", 2525);
try
{
client.Send(message);
}
catch
{
}
I've tried various stuff instead of Request.QueryString["aspxerrorpath"] , however I always end up with an e-mail message similar to the following:
From: from@domain.com [mailto:from@domain.com]
Sent: Friday, May 14, 2010 4:50 PM
To: to@domain.com
Subject: 404 - File or directory not found
The following page generated a 404 error:
And that's it. How can I figure out what page generated the error so I can e-mail the URL or location? Specifically, given the above example, what should I replace Request.QueryString["aspxerrorpath"] with?
Any ideas appreciated. Thanks in advance.
|
|
|
|
|
Nevermind, I figured it out. Request.RawUrl or Request.Url works fine.
|
|
|
|
|
Hi All,
Whats the fullform of MSFT, if it is any tool from MS then pls. provide me any links to study about it. I am googling it, but still I am not able to reach for a conclusion, what it is for. I am still googling.
If you know please help me out in this issue. It is an interview question.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
In what context are you asking? MSFT is the stock market symbol for Microsoft Corporation.
If this was a joke, you got me ...
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Sir,
I am sorry, the big joke is "a company asked me this in an interview. And they disqualify me" for the same. So the companies are playing like this with un-employed ppl. See how pity it is. Sometimes I feel what they expect from me.
Now I feel MSFT is not at all related to my technical skills. And how one person can know everything in the world. If he knows also, how can he remember everything in the world.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
I'm sorry to hear that. Outside the US, I wouldn't expect everyone to know that, but I would expect US developers using Microsoft products to have an idea.
Good luck in your job search. I hope you find something soon. I'll bet next time someone asks, you'll know, right?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
I find it difficult to believe you were rejected because of this one question, or any single question.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Yeah its true and its happening. Even after saying "May be I dont know this, but I can pick it very easily and I am good learner". Even after saying this also, we are (atleast I am) getting rejected.
Sometimes they are asking, to say some query, obviously you can not orally tell them on phone or you might have used the query from google. Even after saying the answer nearly (some times very nearly also) getting rejected.
They want perfect query I should say on phone itself, how can I byhart everything I do.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
How can I change the style sheet that a asp content page uses when being displayed in different versions of IE. I think this can be done in Javascript but am not sure?
Thanks,
Steve Holdorf
|
|
|
|
|
This js mehod would return you the version of Internet explorer.
<br />
function getInternetExplorerVersion()<br />
{<br />
var rv = -1;
if (navigator.appName == 'Microsoft Internet Explorer')<br />
{<br />
var ua = navigator.userAgent;<br />
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");<br />
if (re.exec(ua) != null)<br />
rv = parseFloat( RegExp.$1 );<br />
}<br />
return rv;<br />
}<br />
so this will return the version number.And how to change the css dynamically have a look to the link
Use JavaScript to Change a Cascading Style Sheet (CSS) Dynamically
|
|
|
|
|
I read both articles and am still having problems. I read an article about conditional markup and have tried that. In my case I define the stylesheet theme in the content page such as below and the master page inherits it from the content page. NO problem.
<%
@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" StylesheetTheme="Theme" %>
Now when I try to add the following in the master page the theme is not applied and it tells me that text can not be added between the head element:
<title>
<asp:contentplaceholder id="head" runat="server">
head>
I try adding the conditional text in the content page and still get errors and the theme is not applies. Can anyone help?
Thanks,
Steve Holdorf
|
|
|
|
|
Hi there,
I am looking at the singleton pattern as described by www.dofactory.com. There is also a web project that I am browsing, and it sets all the basic stuff of the website by using the singleton pattern. It sets stuff like the page title, meta tags, javascript, etc etc etc.
When does the static methods in this single pattern get disposed? Once no one is using the website, or when the current user's session is over? Why set the website settings using a singleton pattern?
They mention thread safety as well, what is this and how does it relate to the singleton pattern?
Regards,
Brendan
modified on Friday, May 14, 2010 3:35 PM
|
|
|
|
|