Turn off Outlook warning or extend timer - outlook-2003

I've made a rule in Outlook VB
Sub Test(Item As Outlook.MailItem)
Dim message
message = Split(Item.Body, vbCrLf)
...
End Sub
However, anytime it runs I get this message:
I'm fairly certain this is coming from Item.Body, and I can silence this alert for up to 10 minutes, but I would rather just turn it off entirely.
Is this possible? If not is there a way I can extend the timer past 10 minutes?
This is relating to Outlook 2003 on Windows XP.

You can turn this off by creating\setting the value of CheckAdminSettingsto 1 in the Registry Key HKEY_CURRENT_USER\Software\Policies\Microsoft\Security
see MS Article and MS Article

Related

WMI/ASP Memory Issues

Ive created a server monitoring script written in classic ASP (Hosted on IIS 7.5).
It has a main page which uses jQuery to automatically reload the content (updating WMI information) It works great, but seems to have an appetite for memory!
There are 4 pages (Service status for 2 servers, printer status on a main DC and disk usage on the same server) The service status pages update every 10 seconds, the printers every 5 seconds and disk usage every minute.
The script basically works for a few hours, then i get code 500 internal server errors, once checking the IIS logs its because of it being "Out of memory" and look at the processes on the server and WmiPrvSvc.exe (NETWORK SERVICE account) is in the hundreds (500mb) and the ISS worker process (w3wp.exe) is using about 50mb (there are other w3ps.exe processes that are higher)
Once i end them both it kicks back into action… Or if i stop the page/requests for a while (varies between 30 sec and 5 mins) the WmiPrvScs ends and i don't get the problem.
Is there a way to minimise the memory usage or is there a command to properly disconnect / clear the memory?
Below is the basics of one of my pages to give you an idea of what's going on...
Thanks, Paul.
<%
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery("SELECT Caption, Started FROM Win32_Service WHERE StartMode = 'Auto'")
Set arrServices = Server.CreateObject("System.Collections.ArrayList")
intServices = colListOfServices.Count
For Each objService in colListOfServices
arrServices.Add objService.Caption & "#" & objService.Started
Next
arrServices.Sort()
Response.Write "<table width=""100%"" class=""tblServices"">" & vbCr
For Each strService in arrServices
If InStr(strService, ".NET Framework") = 0 AND InStr(strService, "Sophos Web Intelligence Update") = 0 AND InStr(strService, "Shell Hardware Detection") = 0 Then
' Above services, start at system startup and then stop after nothing to do
arrServiceDetails = Split(strService, "#")
strServiceName = arrServiceDetails(0)
strServiceStatus = arrServiceDetails(1)
End If
Next
Response.Write "</table>"
Set objWMIService = Nothing
Set colListOfServices = Nothing
Set arrServices = Nothing
%>
Are you calling the above code every 10 seconds?
I´m not sure, but i looks like you are creating a new WMI object / connection everytime and that adds up.
Instead try to keep the object around instead of recreating it. Something like a SingleTon class to hold the connection.
Also, try making a strongly typed class instead of the WMI query, you can do that by looking at this site: MGMTClassGen

Response Buffer Limit Exceeded

I am running a simple query to get data out of my database & display them. I'm getting an error that says Response Buffer Limit Exceeded.
Error is : Response object error 'ASP 0251 : 80004005'
Response Buffer Limit Exceeded
/abc/test_maintenanceDetail.asp, line 0
Execution of the ASP page caused the Response Buffer to exceed its configured limit.
I have also tried Response.flush in my loop and also use response.buffer = false in my top of the page, but still I am not getting any data.
My database contains 5600 records for that, Please give me some steps or code to solve the issue.
I know this is way late, but for anyone else who encounters this problem: If you are using a loop of some kind (in my case, a Do-While) to display the data, make sure that you are moving to the next record (in my case, a rs.MoveNext).
Here is what a Microsoft support page says about this:
https://support.microsoft.com/en-us/help/944886/error-message-when-you-use-the-response-binarywrite-method-in-iis-6-an.
But it’s easier in the GUI:
In Internet Information Services (IIS) Manager, click on ASP.
Change Behavior > Limits Properties > Response Buffering Limit from 4 MB to 64 MB.
Apply and restart.
The reason this is happening is because buffering is turned on by default, and IIS 6 cannot handle the large response.
In Classic ASP, at the top of your page, after <%#Language="VBScript"%> add:
<%Response.Buffer = False%>
In ASP.NET, you would add Buffer="False" to your Page directive.
For example:
<%#Page Language="C#" Buffer="False"%>
I faced the same kind of issue, my IIS version is 8.5. Increased the Response Buffering Limit under the ASP -> Limit Properties solved the issue.
In IIS 8.5, select your project, you can see the options in the right hand side. In that under the IIS, you can see the ASP option.
In the option window increase the Response Buffering Limit to 40194304 (approximately 40 MB) .
Navigate away from the option, in the right hand side top you can see the Actions menu, Select Apply. It solved my problem.
If you are not allowed to change the buffer limit at the server level, you will need to use the <%Response.Buffer = False%> method.
HOWEVER, if you are still getting this error and have a large table on the page, the culprit may be table itself. By design, some versions of Internet Explorer will buffer the entire content between before it is rendered to the page. So even if you are telling the page to not buffer the content, the table element may be buffered and causing this error.
Some alternate solutions may be to paginate the table results, but if you must display the entire table and it has thousands of rows, throw this line of code in the middle of the table generation loop: <% Response.Flush %>. For speed considerations, you may also want to consider adding a basic counter so that the flush only happens every 25 or 100 lines or so.
Drawbacks of not buffering the output:
slowdown of overall page load
tables and columns will adjust their widths as content is populated (table appears to wiggle)
Users will be able to click on links and interact with the page before it is fully loaded. So if you have some javascript at the bottom of the page, you may want to move it to the top to ensure it is loaded before some of your faster moving users click on things.
See this KB article for more information http://support.microsoft.com/kb/925764
Hope that helps.
Thank you so much!
<%Response.Buffer = False%> worked like a charm!
My asp/HTML table that was returning a blank page at about 2700 records. The following debugging lines helped expose the buffering problem: I replace the Do While loop as follows and played with my limit numbers to see what was happening:
Replace
Do While not rs.EOF
'etc .... your block of code that writes the table rows
rs.moveNext
Loop
with
Do While reccount < 2500
if rs.EOF then recount = 2501
'etc .... your block of code that writes the table rows
rs.moveNext
Loop
response.write "recount = " & recount
raise or lower the 2500 and 2501 to see if it is a buffer problem. for my record set, I could see that the blank page return, blank table, was happening at about 2700 records, good luck to all and thank you again for solving this problem! Such a simple great solution!
You can increase the limit as follows:
Stop IIS.
Locate the file %WinDir%\System32\Inetsrv\Metabase.xml
Modify the AspBufferingLimit value. The default value is 4194304, which is about 4 MB.
Changing it to 20MB (20971520).
Restart IIS.
One other answer to the same error message (this just fixed my problem) is that the System drive was low on disk space. Meaning about 700kb free. Deleting a lot of unused stuff on this really old server and then restarting IIS and the website (probably only IIS was necessary) cause the problem to disappear for me.
I'm sure the other answers are more useful for most people, but for a quick fix, just make sure that the System drive has some free space.
I rectified the error 'ASP 0251 : 80004005' Response Buffer Limit as follow:
To increase the buffering limit in IIS 6, follow these steps:
Click Start, click Run, type cmd, and then click OK.
Type the following command, and then press ENTER:
cd /d %systemdrive%\inetpub\adminscripts
Type the following command, and then press ENTER:
cscript.exe adsutil.vbs SET w3svc/aspbufferinglimit LimitSize
Note LimitSize represents the buffering limit size in bytes. For example, the number 67108864 sets the buffering limit size to 64 MB.
To confirm that the buffer limit is set correctly, follow these steps:
Click Start, click Run, type cmd, and then click OK.
Type the following command, and then press ENTER:
cd /d %systemdrive%\inetpub\adminscripts
Type the following command, and then press ENTER:
cscript.exe adsutil.vbs GET w3svc/aspbufferinglimit
refers to https://support.microsoft.com/en-us/kb/944886
If you are looking for the reason and don't want to fight the system settings, these are two major situations I faced:
You may have an infinite loop without next or recordest.movenext
Your text data is very large but you think it is not! The common reason for this situation is to copy-paste an Image from Microsoft word directly into the editor and so the server translates the image to data objects and saves it in your text field. This can easily occupies the database resources and causes buffer problem when you call the data again.
In my case i just have writing this line before rs.Open .....
Response.flush
rs.Open query, conn
It can be due to CursorTypeEnum also. My scenario was the initial value equal to CursorTypeEnum.adOpenStatic 3.
After changed to default, CursorTypeEnum.adOpenForwardOnly 0, it backs to normal.

Tips for debugging likely Crystal Reports hang in ASP.NET

Attempting to keep this short: our shipping personnel use a Windows Mobile-enabled barcode scanner to scan the serial numbers of items shipped on customer orders. That data is submitted via asmx web service and a report is automatically printed to a networked printer showing customer info and the details of items shipped. All of this happens in an intranet environment.
Until recently, I was using the Microsoft Report engine built into Visual Studio (.rdlc files) to generate the reports and the code outlined here to print without user intervention. It worked fine that way for several years.
Recently, I ran up against some report formatting limitations in MS Reports and implemented the reports in Crystal Reports (10.5.3700) instead. The code works fine, but after running in production for a few hours to a day or more, the asp.net worker process is hanging (not sure if this is the appropriate term). The report generating/printing process runs forever without throwing an exception. Recycling the AppPool makes everything work again for a while.
The reports are using "push" mode where the report is given a typed dataset rather than accessing the database itself. To take the CR ReportDocument.PrintToPrinter() method out of the equation, I have considered exporting the generated reports to PDF or similar and then printing the resulting file independently. But I haven't found a great way to do that yet.
Researching the problem, I've read all kinds of complaints about the buggy-ness of Crystal, but I'm hoping that there's is a bug in my code related to cleaning up after the report is printed.
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.ReportAppServer
Imports CrystalDecisions.Shared
Public Class CrystalReport
Private _report As ReportDocument
Public Sub New(ByVal Path As String)
_report = New ReportDocument()
_report.Load(Path)
End Sub
Public Sub SetDatasource(ByVal DataSet As DataSet)
_report.SetDataSource(DataSet)
End Sub
Public Sub AddParameter(ByVal Name As String, ByVal Value As Object)
Dim crParameterFieldDefinitions As ParameterFieldDefinitions = _report.DataDefinition.ParameterFields
Dim crParameter1 As ParameterFieldDefinition = crParameterFieldDefinitions.Item(Name)
Dim parameterValue As CrystalDecisions.Shared.ParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue()
parameterValue.Value = Value
crParameter1.CurrentValues.Add(parameterValue)
crParameter1.ApplyCurrentValues(crParameter1.CurrentValues)
End Sub
Public Sub Print(ByVal PrinterPath As String)
_report.PrintOptions.PrinterName = PrinterPath
_report.PrintToPrinter(1, True, 0, 0)
Close()
End Sub
Private Sub Close()
_report.Close()
_report.Dispose()
_report = Nothing
End Sub
End Class
Any ideas for debugging this further? I've never had to resort to real Windows debugging (WinDbg, Process Explorer, etc.), so any recommendation on which debugging tool to try first would be great.
Thank you.
It sounds like the report actually isn't being released, although by looking at your code you would think you are doing exactly that.
You might try Close()ing and Dispose()ing your report object on the Page_Unload event of your ASP.NET page. This forum post on the Microsoft ASP.NET forums talks about an issue where the maximum amount of report processing jobs is reached, but I imagine the issue could be related.

ASP.NET - Log User Session Start/End Times for Audit Trail - Global.ASAX?

My ASP.NET intranet web application uses Windows Authentication, and I would like to record the following details:
1) Windows ID
2) Session Start Time
3) Session Stop Time
4) URL being browsed to (optional)
I've got some basic code setup in "Session_Start" method of the Global.ASAX to log session start times (seen below), but that's it so far. I have the feeling this is a primitive approach and there are "better" ways of doing this. So I really have two questions:
1) Is this the right way to go about doing this? If not what are some other options?
2) If this is the right way, do I just need to drop some code in the "Session_End" method to record the time they exit, and thats a complete solution? Does this method always get called when they close the browser tab they have the site open in, or do they have to close the entire browser (I don't have logout functionality)? Any way users can skip over this session end method (or start for that case)?
Dim connsql As New System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("MyConnectionstring").ConnectionString)
Dim cmdsql As System.Data.SqlClient.SqlCommand = connsql.CreateCommand
cmdsql.CommandText = "BeginUserSession"
cmdsql.CommandType = Data.CommandType.StoredProcedure
Try
cmdsql.Parameters.Add("#windowsid", System.Data.SqlDbType.VarChar, 30, "windowsid")
cmdsql.Parameters("#windowsid").Value = Session("UserInfo").identity.name
If connsql.State <> System.Data.ConnectionState.Open Then connsql.Open()
cmdsql.ExecuteNonQuery()
connsql.Close()
Catch ex As Exception
Finally
If connsql.State <> Data.ConnectionState.Closed Then connsql.Close()
End Try
'Stored Proc records start time
Session_End is not reliable.
What I would suggest is on Session_Start you create a record that notes the time the Session was created, and in Session_End you update the record with the time it was ended.
To handle the majority of sessions which are passively abandoned, use Application_BeginRequest to update the record to note when the user was "last seen".
You will then need to determine a way of marking sessions that have been passively abandoned. This will be site/app specific. It could be as simple as picking a number of minutes that must pass before the session is considered abandoned - like 10 minutes.
So then you have a query:
SELECT Username,
SessionStart,
SessionEnd,
LastSeenOn,
DATEDIFF(mi, SessionStart, ISNULL(SessionEnd, LastSeenOn)) DurationMinutes
FROM SessionAudit
WHERE SessionEnd IS NOT NULL
OR DATEDIFF(mi, LastSeenOn, getdate()) > 10
Which will bring back your session audit log.
Your approach could be described as simple, but that could be totally fine - it comes down to what the requirements are. If you need to log a full suite of application errors and warnings, look at implementing something like Log4Net. Otherwise I wouldn't say there is anything wrong with what you are doing.
Sessions are ended when there has been no user activity for the amount of time specified in the timeout value, or when you explicitly call Session.Abandon() in your code. Because of the stateless nature of HTTP, there is no way to tell if a user has left your site, closed the browser or otherwise stopped being interactive with their session.
I am not sure you can catch the end of the session accurately because
The user can close their browser and that will not necessarily end the session.
They can then go back to your site and thus may have multiple sessions.
You can try messing with setting in IIS to kill the session very quickly after inactivity but its not a good idea.
Also... If the users are not all on an internal network you will have no control as to whether they have a "Windows ID" or not.

Classic ASP: How to list activated sessions?

Is there someway to get a list of activated sessions in classic ASP?
I want to limit the number of simultaneus activated sessions.
Here is a good article which shows a way to do that: Active User Count Without Global.asa by Josh Painter
I guess you have to change some details, but this is the way you could approach the problem. The author doesn't use global.asa.
A simpler way would be to hook the Sesssion_OnStart and Session_OnEnd events in global.asa and adding/removing the item from the list of sessions implemented as an Application variable.
If you just want the count of sessions, you could simply doing it this way:
Sub Session_OnStart
Application.Lock
Application("count") = Application("count") + 1
Application.Unlock
End Sub
Sub Session_OnEnd
Application.Lock
Application("count") = Application("count") - 1
If Application("count") < 0 then ' Could only happen if some other function interfers
Application("count")=0
End If
Application.Unlock
End Sub
In your ASP file
<%
Response.Write "There are currently " & Application("count") & "active sessions>"
%>
You can't access one session from another, so there's no built-in way to get a list of all the active sessions. However, you can use Session_OnStart and Session_OnEnd in global.asa to track the sessions by saving the relevant session info to the Application object, a log file, a database etc (depending on exactly what you want to do with the information).
We tend to track the number of active sessions in an Application object to get a rough idea of how many people are using a site at any given time (bearing in mind, of course, that people will typically have left the site long before their sessions time out). It's not 100% accurate but it's close enough for a guide to current activity.
If you just want the number of sessions, you can also use Perfmon to track the Sessions Current counter (and other related counters) for the Active Server Pages performance object. Obviously this assumes access to the server and probably isn't what you want in this case.
For more info on some options, try this article: How do I count the number of current users / sessions? (archived version)

Resources