How do I get site usage from IIS? - asp.net

I want to build a list of User-Url
How can I do that ?

By default, IIS creates log files in the system32\LogFiles directory of your Windows folder. Each website has its own folder beginning in “W3SVC” then incrementing sequentially from there (i.e. “W3SVC1”, “W3SVC2” etc). In there you’ll find a series of log files containing details of each request to your website.
To analyse the files, you can either parse them manually (i.e. suck them into SQL Server and query them) or use a tool like WebTrends Log Analyser. Having said that, if you really want to track website usage you might be better off taking a look at Google Analytics. Much simpler to use without dealing with large volumes of log files or paying heft license fees.

if you have any means of identifying your users via web server logs (e.g. username in the cookie) then you can do it by parsing your web logs and getting info from csUriquery and csCookie fields.
Alternatively you can rely on external tracking systems (e.g Omniture)

I ended up finding the log files in C:\inetpub\logs\LogFiles.
I used Log Parser Studio from Microsoft to parse the data. It has lots of documentation on how to query iis log files, including sample querys.

Related

Is there any Logviewer application available to see 4GL logs? -PROGRESS 4GL

For me its quite hard to view the 4GL log file. Is there any log viewer application available?
The logfiles are plain text, any text viewer will do.
Which is best depends on your OS and personal preferences.
On linux I'd use less, or vi for "small" logfiles.
On windows I use baretail regularly, but I also use Vs Code, Editpad, ..., notepad
The 4GL Log files should really not be that hard to read?
As a possible built in option: in OpenEdge Management there's a log viewer.
On a newly set up server with classic appserver/adminserver it generally runs on http://<server-ip>:9090/ with credentials admin/admin (to be changed at first login).
This might be different with PAS (I'm not working with that, at least not yet).
We have our databases hosted in AWS so I send all my logs (DB, Webspeed, PASOE, AdminServer, etc etc etc) to Cloudwatch with a relevant retention policy. It's not hard to build a Date/Time parsing formula to calculate when the log entry happens. That way I can give people access to the logfiles easily without them needing access to all the different servers. It's a very neat solution. And we can send non-Progress logs over too, so Apache etc. And grepping them is dead easy too.

Multiple Simultaneous file writes with HMC4 on Classic ASP

I am using Hosted Messaging and Collaboration v4.0 on Classic ASP. My website can have multiple instances depending on how many users are currently logged in. When ever this HMC4 is being used, it logs everything by creating a text file. There is only 1 text file per day, and all HMC4 instances must access this single file to log the usage.
Once in a while I get the error Access to path **** is denied. I have all the permissions set, so the problem is most likely when multiple instances of the application try to write to the log file at the same time.
I am lost at how to fix this, modifying the logging method is impossible since HMC4 is a Microsoft's product and I don't have source code for it, and handling the exception is not an ideal option since I will have to modify the code +70 times across the website.
Any ideas? Thank You.

concurrent reading and writing image files (asp.net, but applies to most web languages)

I have a .jpg file which represents the current image from a webcam. User's will be downloading this file at an interval of once a second. Because there could be dozens of users reading it, this could be dozens of times a second (which is normal for any web server).
Problem is, this image is updated by a 3rd party application also once a second which "spiders" my local networks webcam portal image. This is so we can build our webcams into our current administration panel.
The problem I am already finding is ASP.net sometimes gets an error it can not access the file because it is open for write permissions by the bot. Likewise, the bot can not access it because IIS is feeding it to the user.
The bot uses io.streamwriter to save the data to the file, and my script uses Response.WriteFile to send the file to the script. (I need to use an actual ASP.net page with a JPG content-type that feeds the file to make sure only users with a active session can view the JPG).
My question is what is the best practices for this? I know why it's happening but what is the best resolution for this? Would storing as a BLOB in a database maybe be smarter since databases are created for concurrent read/writing already? Is there an easier way of doing this with a file I have not thought of yet?
Thanks in advance,
Anthony Greco
Using a BLOB will work if the readers use SNAPSHOT isolation model (SQL Server 2005 and up). See Download and Upload images from SQL Server via ASP.Net MVC for how to stream an image from a BLOB, and see Understanding Row Versioning-Based Isolation Levels for a lecture on SNAPSHOT.
But using a BLOB may be overkill, you could get away with something much simpler. For instance, if you only have one ASP.Net process, then you could have a global volatile variable for the current file name. The writer writes the JPG into a new file, and then updates the global 'current' file name with an Interlocked.CompareExchange operation (it has to be Compare because a newer writer might actually finish faster, outrun a previous writer, and you want to preserve the latest update). There are still some issues left to solve (find out the file name at startup, clean up old files etc) but they are all fairly ease to solve.
If you have a farm of servers, or multiple ASP.Net processes serving the site, then things could get complicated. I would still do a rotating file name and do a try-and-error approach (try to respond with newest file, fall back to previous older one if conflict is detected).
You could get the bot to write the data to a different filename and then do a delete and rename to the filename being served by ASP.Net. This should reduce the file lock time down to the time for a delete and rename to occur. To clarify:
ASP.Net serving image from "webcam.jpg"
bot writes image data to "temp.jpg"
when last image byte written, bot deletes "webcam.jpg" and renames "temp.jpg" to "webcam.jpg"
ASP.Net should check "webcam.jpg" exists, if not wait 10ms (or suitable small increment) and check again.

Run a Virus Scan While Uploading files in ASP.NET

I have developed a web based application in ASP.NET and C# where users have the facility to upload files on the server through this application I want the application to Scan the uploaded files for viruses before saving on the server. Same like when we attach files with our email in Yahoo. Please guide me how I can achieve this functionality Any API which can be integrated in ASP.NET application or any other way you can suggest. We can purchase the licensed version of a product which can achieve this. I have googled but did not find specific results.
Thanks in advance!
First of all the file must be saved onto the server before you can scan it. If you notice Yahoo will upload the file first - but not allow the attachment to be sent until scanned.
Then you can use an antivirus with a command line interface or some other kind of API. Both of these can be called via C# and should provide the functionality you require. Parhaps write a wrapper class that takes a file and returns true or false depending on whether a virus was detected.
Other applications that provide you with a command line interface:
Microsoft Security Essentials
clamAv
I believe MS AV provides better results.
Just purchase antivirus software that has a command-line interface (several popular packages include this). Once the file has been uploaded, run the scan.
I would think, in order to upload and scan at the same time, you might need to implement your own antivirus software as I'm not familiar with any package that would provide that sort of interface.
I run a shareware site. It doesn't work as you described, but I download each file to my local computer and run a scan on them. You would be doing something similar.

IIS7 Profiling

Is there a way to profile IIS7? (freeware?)
Number of connections
Bandwidth usage
Errors (Event Viewer?)
-...
thx, Lieven Cardoen
ps: Something similar to mssqlserver profiling
There's nothing quite like MSSQL's profiler, but a set of tools:
Perfmon will show you the # of current connections per website. Perfmon.msc, web service, current connections, select website, click add. Don't like the interactive nature of perfmon? No problem, use logman.exe, a nice CLI for perfmon.
Bandwidth usage you can get from your log files if you enable bytes sent & bytes received in your iis log files. This is also available via performance counters - web service, bytes sent/received/sec. I think the two complement each other fairly well.
IIS7 has a new feature called Failed Request Tracing. You can tell it to log on all 500's,or any .aspx page that takes 15 seconds to run, or based on event severity. It saves all of this information in an XML file for you under \inetpub so it's easily parseable, and also gives you a nice XSLT to view it in your browser and drill down if you like.
http://learn.iis.net/page.aspx/266/troubleshooting-failed-requests-using-tracing-in-iis7/
Try out the Administration Pack for IIS 7.0. It has:
Configuration Editor:
The configuration editor module will help you manage your configuration files. This tool is available for server administrators only. It allows you to edit any section, attribute, element or collection in your configuration file. In addition to editing these values you are also able to lock and unlock them. The configuration editor also allows you to generate scripts based on the actions you take as well as search the file to see where values are being used.
IIS Reports:
The IIS Reports module enables you to view key statistics about your website. You can also generate your own module reports to gather information relevant to you and your business. Currently you can view the output of these reports as charts and/or tables.
Database Manager:
This module is no longer part of the Administration Pack and instead is offered as a separate download in the IIS Download Center.
UI Extensions:
UI Extension modules allow you to manage existing features through IIS Manager.
The FastCGI module allows you to manage your FastCGI settings.
The two ASP.NET modules allow you to manage your authorization and custom errors settings.
Finally the HTTP Request Filtering allows you to setup rules for http request filtering.

Resources