ASP.NET - pasting an image on web form - Asked By Anjali agarwal on 28-Jan-10 11:20 PM


I want to paste the images directly on the web form using Ctrl-V. Is it possible to do that. We have rich text box in our office, but rich text box does not allow to paste images directly, we have to upload them first.

any help willbe appreciated

Sakshi a replied to Anjali agarwal on 28-Jan-10 11:53 PM

a activex control which does pasting image is in the link,

also see this,

Thanks and Regards,

Huggy Bear replied to Anjali agarwal on 29-Jan-10 12:33 AM
My doubt is whether you want to do this at run time or design time. In design time it is not possible for sure you should go about providing the ImageUrl for asp:Image and src for img tags. At runtime I think you should be able to use javascript to achieve it. link would help.

mv ark replied to Anjali agarwal on 29-Jan-10 02:39 AM
Due to security reasons, browsers don't allow interaction with the file system. Hacks may exists for IE but there is no cross-browser way to achieve this
Anjali agarwal replied to Huggy Bear on 02-Feb-10 12:13 PM


  Thanks for your reply. I am trying to paste the image at runtime. I wrote the code below, but I am not sure how will I invoke it from code behind.

Below is the front end code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register TagPrefix="RTB" Namespace="RichTextBoxControl" Assembly="RichTextBox" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<script language="javascript" type="text/javascript">

functiion test()


cursor_selection = document.getElementById('MessageTextBox').contentWindow.document.selection.createRange();




<html xmlns="" >

<head runat="server">

<title>Untitled Page</title>



<form id="form1" runat="server">




<td style="width: 323px">

<rtb:richtextbox id="MessageTextBox" runat="server" Width="1072px" Height="214px" ButtonType="Image"

HtmlOptionIsEnabled="False" ></rtb:richtextbox>








In the back end, I don't have any code

using System;

using System.Data;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page


protected void Page_Load(object sender, EventArgs e)