Questions tagged [message-handlers]

73 questions
11
votes
1 answer

web api - message handler attribute routing

Does anyone know whether message handler can work simultaneously with attribute routing in Web API 2.x? I got a custom message handler to work using conventional routing, then after adding attribute routing, it stops working. I am not sure whether…
cng
  • 111
  • 5
8
votes
2 answers

How to add MessageHandler for a specific controller that is using Routing Attributes in ASP.NET WebAPI 2?

It is possible to add a MessageHandler only for a specific controller that is using Route Attributes? I want to cut the request earlier in the pipeline if it doesn't contain certain headers. I want to mention that: I can't add another route in…
5
votes
1 answer

Message Handlers and the Http Module?

In ASP.NET Web API, HTTP requests and responses are processed in a pipeline on the server. If I want to add some logic or global behaviour at the very early stages of the pipeline , I should do it in the Message Handler. ( for example :…
Royi Namir
  • 144,742
  • 138
  • 468
  • 792
4
votes
0 answers

Web API route with custom handler not working

I'm trying to add a route to my WebAPI with a custom message handler like so config.Routes.MapHttpRoute( name: "TestRoute", routeTemplate: "Protected/TestMe", defaults: null, constraints: null, handler: new…
4
votes
2 answers

Use OWIN middleware or a delegating MessgaeHandler to log api requests/responses?

In my old non-OWIN APIs, I use a MessageHanlder to log all HttpRequests and HttpResponses. Here is the MessageHandler: public class MessageHandler : DelegatingHandler { private static readonly ILog RequestApiLogger =…
BBauer42
  • 3,549
  • 10
  • 44
  • 81
2
votes
2 answers

pyTelegramBotAPI message handlers can't see photo

I need my telegram bot to forward messages from the private chat to the customer care staff group. I run this code: @bot.message_handler(func=lambda message: message.chat.type=='private') def forwarder(message): bot.forward_message(group,…
carcaduno
  • 31
  • 3
2
votes
1 answer

Telegram bot message_handler with lambda

I´m trying to use the @bot.message_handler with lambda to capture some words in the messages sending in a group with my bot. I see a lot of examples and everybody use a code similar to this: import…
Alberto Aguilera
  • 311
  • 1
  • 5
  • 13
2
votes
1 answer

NServiceBus Deserialization Exception After Deployment

I am currently using NServiceBus6. I am successfully submitting a message from my web api to endpoint which is windows service hosted. Everything works fine in my development environment on my local machine. I am using "NewtonsoftSerializer" in…
William
  • 317
  • 2
  • 12
2
votes
1 answer

C# Web Api, Log request after response has been returned to client

I've recently created a logging solution for my application whereby my web servers send all request/response data to a log over HTTP to a logging server. I've done this using delegating…
Carlos Rodriguez
  • 2,190
  • 2
  • 18
  • 29
2
votes
1 answer

Sitecore: pass language information with menu item command/message

I'm working with Sitecore 8 Update 2. I have extended the default TreelistEx class with my own. I've added a menu item that sends out the following message: mytreelistex:myadd(id=$Target) I would like to know what language the item is that the…
Timon
  • 1,003
  • 1
  • 9
  • 38
1
vote
1 answer

Window Message Handling functions somehow change Value of int variable which should remain untouched

In my Window_manager.c file I nowhere edit the Value of *wm->actStkSize by hand (!?), however after calling DispatchMessage(&msg); in the RunMessageLoop function, the Value somehow changed from 0 to 66, I have absolutely no idea how. main.c: int…
flotschi
  • 13
  • 3
1
vote
2 answers

I can't make second msg handler after keyboard button in telegram bot on python telebot

@bot.message_handler(content_types=['text']) def get_text_messages(message): if message.text == "/start": begin = types.InlineKeyboardMarkup() namebutton = types.InlineKeyboardButton(text="Name urself", callback_data="nm") …
sword
  • 11
  • 2
1
vote
0 answers

How to parse form content in DelegatingHandler

I'm trying to create a custom message handler which adds an Authorization header to all requests sent by an HttpClient. In order to compute the value of this header, the path of the request (including query parameters) must be concatenated with the…
jack
  • 147
  • 1
  • 7
1
vote
1 answer

Asynchronous function in telegram bot

From understanding basics of async/await I learned that time.sleep() is a blocking function, which freezes the execution. I tried to check it in this simple message_handler while creating a telegram bot. import telebot from time import sleep token…
1
vote
1 answer

Limit Access to a Telegram Bot

I've written a telegram bot using aiogram. I want to restrict it so certain users can access it. I've read this question, which has answers for different telegram bot libraries. But for the aiogram, the only solution I've found is to add an "if…
1
2 3 4 5