ELMAH filter crawler errors - filter

I´m using the ELMAH to handle the application errors but I´m receiving a lot of errors of crawler access. How can I filter the errors only for user access, no robots.
Best regards
Ernesto

You should check out Filtering with ELMAH. Filtering lets you write code in c# or scripted through JScript, which can dismiss the exception from being logged. In you case, I would write something like this:
void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
{
if (HttpContext.Current.Request.UserAgent.Contains("bot"))
e.Dismiss();
}
Checking for "bot" is a very simple example. There are lists containing user agents from bots all over the web. Evil bots typically don't reveal themselves through it's user agent, why tracking down requests from them will be a hard one.

Related

Is it possible to trigger TravisCI build by Slack message w/o spinning up my own server?

When I did research online, most of the solutions are about triggering Slack notification from TravisCI. Now I want to do the reverse direction - type some message in slack, and trigger a build task in TravisCI.
I'm looking at Slack's Outgoing WebHooks - under their "Custom Integrations" in Slack app directory. However, their webhook POST data spec is fixed, not seem to be programmable through just their webpage UI. They have a column in the UI that lets you fill in URL(s) to POST to. But I don't see any ways that I can customize the data field of the POST request.
Same as TravisCI's Triggering Builds API v3, the data fields they expect in the POST are fixed and unchangeable.
I know I can sign up a cloud service, write some code and spin up a server to re-package the parameters to do the work, like a middleware between these 2 APIs. But just want to see if anyone manages to achieve triggering TravisCI by Slack in such way that doesn't involve spinning up a server myself?
I ended up hosting a server and writing the porting logic myself. I guess there's no simple way to do this, after all they are different APIs. Here is the code where I request against travisCI API, and here is the code where I unpack the slack webhook POST request.

Microsoft Flow integration

I read an article about Microsoft Flow. I was wondering if it is possible to trigger events using this in an external website.
For instance, supposing a post is made on Yammer for some approval flow based application. If an authorized user comments saying "Approved", this must trigger an action in my external website.
Is this feasible using Flow?
You can also make your own custom connectors if your website has a RESTful API. https://learn.microsoft.com/en-us/flow/register-custom-api
There is an event for Yammer in Microsoft flow. I have something set up similar for my company and Twitter. When our company is mentioned it sends a message off to our social director.
I have several such flows for things like Yelp, Twitter, Facebook.
You need your Yammer account.
The events that you can trigger from and then include a trigger word or phrase are:
Get All messages
Get Messages in a group
Get Messages from my Following Feed
Post Message
Once you have that trigger its simple enough to look for the key word within a condition step.
Chances are good there is already a template for this in Microsoft Flow. Just look at the ones for Yelp, Facebook, etc. and modify for your needs
Just as AJAX mentioned, you can apply your own Custom Connector for a case like this. A Connector is the "plugin" used with a Flow, such as Yammer.
It's a bit late since November 28th (practically a 30-day late response here), but PowerApps allows you to create your own Custom Connector applying Microsoft's API. You'd be able to plug into your website (GET, POST, etc) directly with this when you create a trigger (the condition met true) that would launch an action. If you created your own API, Microsoft would have to validate if it's met standards pertaining to security.
By applying PowerApps, you'd be able to create your own actions and triggers. From this, you can integrate your own web based process' based on documentation that was observed: https://powerapps.microsoft.com/en-us/blog/brand-new-custom-api-experience-in-powerapps/. From here, you'd be able to customize it was needed.
JSON is required for some circumstances, however Postman would be a great IDE to consider as it also applies a pre-approved API by Micrsoft.

Use Application Insights to view all REST API requests per user

We are developing a WebApi2 application. Users can use the REST API using their specific API key. I am investigating how to setup Application Insights to be able to see the usage of the REST API endpoints per user.
I have been experimenting with using telemetryclient.TrackPageview(endpoint-ID) and telemetryclient.TrackEvent(endpoint-ID), but I am not sure if this is the right way to go. And how should I pass the user-ID (API-key) in the tracking call? As telemetryclient.Context.User.Id? Or using properties or some other way? I would like to be able to use the user-ID to aggregate/segment the pageviews/events that were registered for that particular user. Any ideas are welcome!
I'd suggest using the built in properties, like context.user.id whenever possible, and then custom properties after that.
Currently in the portal, from the search view you can then find an item for any user, then use the "related items" to view "all telemetry for this user" to see all of the items.
Then can use the App Analytics portal to do queries (click the "analytics" button toolbar in the overview blade for your resource azure portal to go to the AA site for that resource), and that service lets you write much richer queries.
in those queries, it's easiest to group/filter on the "built in" properties, for custom properties you have to write a little bit more complicated queries to parse the values out of custom code.

How can i use Dhtmlx Messages in chat application

In your dhtmlx message sample examples you said that we can use
dhtmlx messages to communicate with application users.
That was a great idea.
But how can i do that?
Any hints?
Thanks,
Naresh Adla
you probably misunderstood the whole point of dhtmlxmessage, the purpose of that "module" is to communicate your users about actions they perform on your web application, like sending error messages when they do something wrong,or success message, or being able to confirm certain actions like for example deleting or modifying certain information,.
If you wish a javascript chat application you could check here Jquery CHAT API
or there are plenty of other javascript chat applications, but certainly dhtmlxmessage won't work as a chat.

Aggregating HTTP Response Codes for Reporting in ASP.NET

I am new to the Windows IIS environment, coming from Linux/Apache. At my new job (ASP.NET shop), they don't currently monitor 404s or any other non-200 HTTP response codes so problems with missing images and files from the website or 500 errors don't surface until a customer emails us weeks later.
What do you guys use to monitor, aggregate and display these responses in .NET? In my old job, I had a script attached to the 404 handler that inserted into a database and from there I created a dashboard that grouped and displayed all the 404s so it was easy to see issues with missing files, etc.
Not sure if it's best to handle at the application level or with some log file aggregator.
What is the best practice for doing the same in ASP.NET?
I appreciate any advice on this
Thanks
You may take a look at ELMAH which is specifically designed for this purpose.

Resources