.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

the code for writing a image from the pixels generated...

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :Windows Application

dear sir/madam,

    i have written a code in asp.net to read an image from file uploader,,from this image i have extracted RGB values(for each pixel)...now i have to write a image using this RGB values itself ,so that the image will be same as image i have read...i have writurn the code but i am not getting the image..please help me in writing this image..please

public partial class _Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)
            Image1.Visible = false;
            Image2.Visible = false;
            Label1.Visible = false;
            Label2.Visible = false;

    protected void Button1_Click(object sender, EventArgs e)  //to read imag e and extract RGB

        Image1.Visible = true;

        String filename = null;
        string path = null;
        if (FileUpload1.HasFile)
            filename = FileUpload1.FileName.ToString();
            path = "~/image/" + filename;

        String[] getExt = filename.Split('.');
        Label2.Text = getExt[1];
        Image1.ImageUrl = "~/image/" + filename;

        System.Drawing.Image imgs = System.Drawing.Image.FromFile(

View Complete Post

More Related Resource Links

CLR Inside Out: Writing Reliable .NET Code


Here's a look at how code fails and techniques for writing more reliable and resilient managed code.

Alessandro Catorcini and Brian Grunkemeyer

MSDN Magazine December 2007

Code Name Longhorn: A First Look at Writing and Deploying Apps in the Next Generation of Windows


The next version of the Microsoft Windows operating system, code-named "Longhorn," marks a significant change not only in terms of how the operating system works, but also in the way in which applications are built. The Longhorn version of Windows includes a new storage system, natural search technology, and an increased emphasis on security and trustworthy computing. Here the author provides an overview of Longhorn, focusing on the build-once, deploy n-times application model. In addition, he discusses the new language, code-named "XAML," that's used to create UI elements, then presents some working samples.

Dino Esposito

MSDN Magazine January 2004

C# and the Web: Writing a Web Client Application with Managed Code in the Microsoft .NET Framework


When the author wanted to build a middleware Web client to connect to other applications over the Internet, he realized that the XMLHttpRequest COM object was not sufficient for his purposes. In order to build a Web client using managed code, the author had to use the HTTPWebRequest and HTTPWebResponse classes provided by the Microsoft .NET framework. These classes are used in the sample project as a substitute for the less powerful XMLHttpRequest COM object, allowing the author to build a full-featured Web client. They also take advantage of all the benefits that the CLR and managed code have to offer.

Avi Ben-Menahem

MSDN Magazine September 2001

Writing connection string in web.config file by code or dynamically

I want to write connection string in web.config file of my application by code. If anyone know the way or code just help me..NET,C#,SQL SERVER

SvcUtil-generated code or shared interface/data contract assembly?

If you control both service and client is there any benefit in using svcutil.exe to generate client proxies? Or is it better to share interface/data contract assembly between client and service?

Response to Image URL using Code Behind

Hi guys, sorry just not really sure on how the title should go.Anyway, I got this scenario:If URL point to a URL, let say http://samplewebsite.com/sampleimage.gif,I may want ASP.Net to handle the "sampleimage.gif", so that it can be fetched from database server, using HttpResponse.Write();My question is how can IIS/ASP.Net recognize sampleimage.gif is actually pointing to a aspx page?Is this possible?Anyway help is appreciated. Thanks

Get the current user without writing code

i have a question regarding the "Get the current user without writing code" tutorial. http://blogs.microsoft.co.il/blogs/itaysk/archive/2007/04/05/InfoPath-_2D00_-Get-the-current-user-without-writing-code.aspx?from=ClayCobb the url that i have to enter in the web service details is not working for me. do i have to use the same url for wss 3 also? maybe i have to ask this: can this be used for sharepoint services 3.0? i have enter: http://servername:portnumber/_vti_bin/UserProfileService.asmx  when i open it in a browser it gives me the sharepoint error page and when i insert the url in infopath it gives me this error: the file is not a valid XML file. The form contains XML that cannot be parsed: a string literal was expected, but no opening quote character was found. Line 19,position 38 <TABLE class="ms-main" CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH="100%" HEIGHT="100%">

Code behinds in MVC2 - How to inject auto-generated code into views via partial classes?

Background:I have written a t4 template that basically replaces the work done by StronglyTypedResourceBuilder to give design time access to string resources as properties of classes, one class per resource file.  Why?  Well I needed to add some customer code that handles string token substitution and a few other customizations.  Anyway, the template is working out really well and I may blog on it soon.In the mean time though, following a common pattern, I have one .resx file for each view, master page, controller, etc.  I would really like my t4 template to add a property to each such entity that gives quick access the custom resource class associated with it.  For controllers this is easy.  T4MVC is ensuring that they are a all declared partial.  All I need to do is create the appropriate partial class in my output that declares a readonly property that returns an instance of the appropriate generated resource class.The Problem:I would like to do the same thing, inject generated code, into my views.  Were this traditional ASP.Net, each .aspx page would have a .aspx.cs page and possibly an .aspx.designer.cs page that are all partial classes extending in the aspx page's class definition.  There is no such thing by default in MVC and for good reason.  However, I think for my purposes, if there is a way to do this, it

convert image to rtf code

how can i convert image to rtf code

How to get rid of entitysets in code that is generated using sqlmetal

hiI am using sqlmetal to generate code.below is the line i am using for code generation.SqlMetal.exe  /server:localhost /database:abc /code:..\Entities\CoreEntities.Generated.cs /namespace:abc.DAL /Context:abcDataContext /pluralizeIts working perfect but tables association are also generated , which I dont want in my code.Its generating code for table associations as well.[Association(Name="FK_Profile_LogonInfo1", Storage="_EXPRESS", ThisKey="EXPRESSEDTOUSERID", OtherKey="ID", IsForeignKey=true)]I feel that they are not required in front end, so I dont want sqlmetal to generate code for table associations.Please guide me.thanksSuman

writing to view output stream from <% ... %> code


how does the code within the <%  .... %> brackets write to the output stream of a view?

Where view code that looked like the following would write the HTML for a <table> to the output html of the view.

ToViewOutput( "<table>" ) ;
ToViewOutput( "<tr>" ) ;
ToViewOutput("<td>row1. cell 1.</td>") ;
ToViewOutput("<td>row1. cell 2.</td>") ;
oViewOutput("</tr>") ;
ToViewOutput("</table>") ;




Writing image binary data to the Response


Hi there,

I've created 2 web user controls. A = User control that displays an image, and B is the user control that hosts A. I'm trying to stream an array of bytes to A, but it seems like the Response.BinaryWrite method completely overwrites any heirachial controls (I can't see any of B's other controls besides the image).

How do I get A to just display the image from the byte stream? It doesn't come from a database, it's an image I created on the fly.

A's code:

        public void UpdateImage(byte[] imgbytes)
            Response.ContentType = "image/jpg";


Looking for sample css code to magnify or alter an image buttons bakground when hovering over them


I have a list of buttons in a menu, and when I hover of them, I want something to change, such as a box being drawn around them, or background color chaning.  How do I do that? 

Issue with Proxy code when generated for WCF service



There is an issue I am going through when generating Proxy code for my WCF services. Whenever I generate Proxy code for services with methods having VALUE Type parameters, additional BOOL parameter <parameter>Specified is added to the generate Proxy Code.

So if I have method - Employee GetEmployee(int Id), the respective proxy code for this method will be - Employee GetEmployee(int Id, bool IdSpecified).

Moreover, if you do not set this bool parameter value to TRUE, no value will be passed to the End service.

I can understand this can come handy when handling Null inputs, but that will not be always the case.

After doing some R&D, I found that if I add Data Format attribute of type RPC to my Method contract, these parameters are removed. Like if I add: 

[DataContractFormat(Style = OperationFormatStyle.Rpc)] , the generated proxy code reflects all value type parameters as is.

I am not an expert in WCF, and for the same reason I don't have much idea on what significance this attribute plays for the service methods. Can adding this attribute introduce problems when consuming these methods by application in .NET 1.1 or in JAVA?


Can anyone help me in getting ride of this additional parameter in the proxy?

Thanks in Advance.




Reference to a non-shared member requires an object reference in code generated by ASP.NET



I am working on converting a project from C# to VB and am facing this weird issue. 1 page cannot compile and I get the reference error, but the weird thing is that the compiler shows the error as coming from ASP.NET generated code. Visual Studio shows me that error is coming from my ASPX page. I cannot seem to figure out why or where this error is occuring. Also if I take the inherits attribute out I don't get the compilation error. The code in aspx page is below:

<%@ Page Language="VB" AutoEventWireup="true" CodeBehind="diff.view.aspx.vb"  Inherits="MR.ControlApp.diffview" MasterPageFile="~/Site1.Master"%>

<asp:Content ID="Header1" ContentPlaceHolderID="head" runat="server">

    Page: <select onchange="sel(this);">
        Dim j As Integer = 0
        While j < pageCount
           <option <%= IIf(currentPage = ( j + 1 ), "selected", "")  %> value="<%= j+1 %>"><%= j + 1 %></option>
        <%j = j + 1
        End While
    <% 'Print(); %>
    <div style="font-family: verdana; font-size: 10pt; font-weight: bold">
        MDM Data Inconsiste

Is the executable file generated by compiler a Managed code or Unmanaged code ?



when we compile our vb.net or c#.net code (say in a simple console application) then in bin\Debug folder a .exe file is created.Is that a managed code? when i directly execute this file,will this target CLR ? or will it directly run on OS ?

Why there is ConsoleApplication1.vshost.exe.manifest files created in that folder ?

What is .pdb file ?

That executable file is also created in obj\Debug folder .Why ?

VS2010 - Problem with WinForms generated code



I'm having trouble with the code that is generated automatically by the WinForms designer, sometimes it generates code that uses the 'components' (IContainer) in the constructors of disposable components and other times it doesn't.

Here is some code. First the code that is generated in a clean new project with just one component on the form:

  private void InitializeComponent()
   this.components = new System.ComponentModel.Container();
   this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components);
   // errorProvider1
   this.errorProvider1.ContainerControl = this;
   // Form1
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend