TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Waqasyousaf Yousaf
NA
3
1.5k
not showing the image properly
May 1 2018 5:41 AM
not showing the image showing like this
using
System.Net;
using
System.Net.Http;
using
System.Threading.Tasks;
using
System.Web.Http;
using
Microsoft.Bot.Builder.Dialogs;
using
Microsoft.Bot.Connector;
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web.Http.Description;
//using Microsoft.Bot.Connector.Utilities;
using
Newtonsoft.Json;
namespace
Bot_Application3
{
[BotAuthentication]
public
class
MessagesController : ApiController
{
/// <summary>
/// POST: api/Messages
/// Receive a message from a user and reply to it
/// </summary>
public
async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
if
(activity.Type == ActivityTypes.Message)
{
ConnectorClient connector =
new
ConnectorClient(
new
Uri(activity.ServiceUrl));
int
length = (activity.Text ??
string
.Empty).Length;
//Activity reply = activity.CreateReply($"You sent {activity.Text} which was {length} character");
Activity reply = activity.CreateReply(
"images of lahore garrison university"
);
reply.Attachments =
new
List<Attachment>();
reply.Attachments.Add(
new
Attachment()
{
ContentUrl =
"http://www.lgu.edu.pk/assets/img/logo.JPG"
,
ContentType=
"image/jpg"
,
Name=
"LGU.JPG"
});
await connector.Conversations.ReplyToActivityAsync(reply);
}
else
{
HandleSystemMessage(activity);
}
var response = Request.CreateResponse(HttpStatusCode.OK);
return
response;
}
private
Activity HandleSystemMessage(Activity message)
{
if
(message.Type == ActivityTypes.DeleteUserData)
{
// Implement user deletion here
// If we handle user deletion, return a real message
}
else
if
(message.Type == ActivityTypes.ConversationUpdate)
{
// Handle conversation state changes, like members being added and removed
// Use Activity.MembersAdded and Activity.MembersRemoved and Activity.Action for info
// Not available in all channels
}
else
if
(message.Type == ActivityTypes.ContactRelationUpdate)
{
// Handle add/remove from contact lists
// Activity.From + Activity.Action represent what happened
}
else
if
(message.Type == ActivityTypes.Typing)
{
// Handle knowing tha the user is typing
}
else
if
(message.Type == ActivityTypes.Ping)
{
}
return
null
;
}
}
}
Reply
Answers (
1
)
SMTP mail transfer error authentication
Unit Test WebAPi