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


Top 5 Contributors of the Month
sivanagamahesh
Post New Web Links

Response to Image URL using Code Behind

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :ASP.Net
 
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


View Complete Post


More Related Resource Links

convert image to rtf code

  
how can i convert image to rtf code

How to set Page title for Response.ContentType = "image/jpeg"

  
Hi , how can i set Title for a page with Response.ContentType = "image/jpeg" ? thanks, Naresh

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";
            Response.BinaryWrite(imgbytes);
            Response.End();
        }


Thanks!



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? 


Improving response with code - is this bad practice?

  

I am trying to optimize my code in C# to gain as much speed as possible.  I"ve been looking at this article and one of them talks about:

19) Never use object value directly; first get object value in local variable and then use. It takes more time then variable reading.


So what does this mean?  Does this mean that lets say I want to access an integer in object test, such that the integer is called test.someval.  I should do this instead?:

int temp = test.someval; //create a local variable in page class

temp = 12345;  //assign some value

test.someval = test; // store it back to temp?



Secondly, how bad is having all these "Convert.To" ??

if (Convert.ToSingle(datapoints[i]) > peak) { peak = Convert.ToSingle(datapoints[i]); }
                if ((prev <= wc_pos) && (Convert.ToSingle(datapoints[i]) > wc_pos)) { wfmstart = i; }
                if (Convert.ToSingle(datapoints[i]) > wc_pos) { peaks[i] = (float)Math.Round(Convert.ToSingle(datapoints[i]),1) ; }
                if (prev > wc_pos &am

When binding value to ImageUrl property of Image using XPath it shows code as html markup on fronten

  

I have a listview in which I want to show an image from an xmldatasource control.

The following works, and shows the value of thumb (in this case: 12_634232073402187500_whatever.jpg)

<asp:ListView ID="repLocationsToCompare" ItemPlaceholderID="itemsGoHere" runat="server">
    <ItemTemplate>                        
            <%# XPath("thumb")%>
    </ItemTemplate>
</asp:ListView>
<asp:XmlDataSource EnableCaching="false" XPath="root/data/compare/locations/location" ID="XMLDSCompare" runat="server"></asp:XmlDataSource>

No problem there, BUT, when I use an imagecontrol:

<asp:ListView ID="repLocationsToCompare" ItemPlaceholderID="itemsGoHere" runat="server">
    <ItemTemplate>                        
            <asp:Image ID="img" Visible='<%# XPath("thumb

PublishingWebControls:RichImageField show html code for the image instead of rendering the image

  

I am modifying the article page layout to display more than one image. The rendered page does not show the image. Its showing the <img> tag instead.

Please help!


Soap cs code from WSDL encoding response problem

  

I have created a client proxy from a WSDL file with WSDL.exe

i can both send and recieve data fine.

The xmlfile i recieve contains Nordic char data (i see that in fiddler).

ex: <mydata>øæå</mydata>

The problem occurs when the data goes into my client proxy. It looks like they are in utf-8 format (and that will not work with nordic chars).

so the nordic chars are just scrambled.

any way to override this ?

 object[] response = this.Invoke("Query", new object[] { message });
 message = ((elements)(response[1]));
 return (string)(response[0]);

 

 

 


how to insert image into sql server manually (without code)

  
Can someone please tell me how to insert image into SQL server 2005 manually - without code.

I'm set the field as data type "image" and tried classical copy paste method, but without result.

thanks


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

  

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;
      

        ListBox1.Items.Clear();
      
        String filename = null;
        string path = null;
        if (FileUpload1.HasFile)
        {
            filename = FileUpload1.FileName.ToString();
            path = "~/image/" + filename;
            FileUpload1.PostedFile.SaveAs(Server.MapPath(path));

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

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

Code Optimized Web Development Profile (VS 2010 and .NET 4.0 Series)

  
When you first run VS 2010 it prompts you to select an IDE profile to use. The profile you select will configure how tool windows are displayed/docked in the IDE by default and set the default keyboard shortcuts. You can then customize any of these settings by using the Tools->Options menu within the IDE and then override/change them. You can also later reset your profile and pick a different one by choosing the Tools->Import and Export Settings menu command.

Free Code Snippets - ASP.NET

  
You Can Find Useful ASP.NET Related Posts on the above link.

Free Code Snippets - C#

  
Free C# Code Snippets

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side

Microsoft StyleCop: Source Code Analyzer for C#

  
StyleCop is similar in many ways to Microsoft Code Analysis (specifically FxCop), but there are some important distinctions. FxCop performs its analysis on compiled binaries, while StyleCop analyzes the source code directly. For this reason, FxCop focuses more on the design of the code, while StyleCop focuses on layout, readability and documentation. Most of that information is stripped away during the compilation process, and thus cannot be analyzed by FxCop.

Built-in Functions - Text and Image Functions in SQL Server

  
Text and image functions operate on TEXT, NTEXT and IMAGE data types. These data types are deprecated with SQL Server 2005 and should be replaced by VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) when possible. Alternatively you can also consider storing large string values using XML data type. Text and image functions are nondeterministic.

Future versions of SQL Server will not support TEXT, NTEXT and IMAGE data types. Columns with TEXT / NTEXT data type do not support commonly used string functions such as LEN, LEFT, RIGHT, etc. Furthermore, due to the large size of TEXT data you''re likely to see performance issues if you store such data in the database. However, at times you can''t help but use the TEXT / NTEXT / IMAGE data types (for example when supporting 3rd party databases when you cannot change the schema) - this is when text and image functions come in handy.
Categories: 
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