Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. images are not uploading in windows7 and vista using asp.net with c#

images are not uploading in windows7 and vista using asp.net with c#

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasesql-serverdesign
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    developerit
    wrote on last edited by
    #1

    hi , iam using asp.net 2.0 with sql server 2000 in my site if iam using xp operating system all clients are able to upload the pictures but the clients those who are using windows7 and vista the are getting errors can you correct my code

    <%@ WebHandler Language="C#" Class="right7" %>

    using System;
    using System.IO;
    using System.Data;
    using System.Data.SqlClient;
    using System.Configuration;

    using System.Web;
    public class right7 : IHttpHandler {

    public void ProcessRequest (HttpContext context) 
    {
        string branchid = "";
    
        //if(context.Session\["branchid"\]!=null)
        if (context.Request.QueryString\["branchid"\] != null)
    
    
            branchid = context.Request.QueryString\["branchid"\];
        else
            throw new ArgumentException("No parameter specified");
    
        context.Response.ContentType = "image/jpeg";
        Stream strm = ShowImage(branchid);
        byte\[\] buffer = new byte\[4096\];
        int byteSeq = strm.Read(buffer, 0, 4096);
    
        while (byteSeq > 0)
        {
            context.Response.OutputStream.Write(buffer, 0, byteSeq);
            byteSeq = strm.Read(buffer, 0, 4096);
        }
        //context.Response.BinaryWrite(buffer)  
    }
    public Stream ShowImage(string branchid)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings\["transfer"\].ConnectionString);
        string sql = "SELECT imgright7 FROM tblImages WHERE BranchId = @BranchId";
        SqlCommand cmd = new SqlCommand(sql, con);
        cmd.CommandType = CommandType.Text;
        cmd.Parameters.AddWithValue("@BranchId", branchid);
        con.Open();
        object img = cmd.ExecuteScalar();
    
        try
        {
            return new MemoryStream((byte\[\])img);
        }
        catch
        {
            return null;
        }
        finally
        {
            con.Close();
        }
    }
    
    public bool IsReusable {
        get {
            return false;
        }
    }
    

    }

    using System.Data;
    using System.Data.SqlClient;

    using System.Configuration;
    using System.Collections;
    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 right7image : System.Web.UI.Page
    {
    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["transfer"].ConnectionString);

    string branchid =
    
    A T 2 Replies Last reply
    0
    • D developerit

      hi , iam using asp.net 2.0 with sql server 2000 in my site if iam using xp operating system all clients are able to upload the pictures but the clients those who are using windows7 and vista the are getting errors can you correct my code

      <%@ WebHandler Language="C#" Class="right7" %>

      using System;
      using System.IO;
      using System.Data;
      using System.Data.SqlClient;
      using System.Configuration;

      using System.Web;
      public class right7 : IHttpHandler {

      public void ProcessRequest (HttpContext context) 
      {
          string branchid = "";
      
          //if(context.Session\["branchid"\]!=null)
          if (context.Request.QueryString\["branchid"\] != null)
      
      
              branchid = context.Request.QueryString\["branchid"\];
          else
              throw new ArgumentException("No parameter specified");
      
          context.Response.ContentType = "image/jpeg";
          Stream strm = ShowImage(branchid);
          byte\[\] buffer = new byte\[4096\];
          int byteSeq = strm.Read(buffer, 0, 4096);
      
          while (byteSeq > 0)
          {
              context.Response.OutputStream.Write(buffer, 0, byteSeq);
              byteSeq = strm.Read(buffer, 0, 4096);
          }
          //context.Response.BinaryWrite(buffer)  
      }
      public Stream ShowImage(string branchid)
      {
          SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings\["transfer"\].ConnectionString);
          string sql = "SELECT imgright7 FROM tblImages WHERE BranchId = @BranchId";
          SqlCommand cmd = new SqlCommand(sql, con);
          cmd.CommandType = CommandType.Text;
          cmd.Parameters.AddWithValue("@BranchId", branchid);
          con.Open();
          object img = cmd.ExecuteScalar();
      
          try
          {
              return new MemoryStream((byte\[\])img);
          }
          catch
          {
              return null;
          }
          finally
          {
              con.Close();
          }
      }
      
      public bool IsReusable {
          get {
              return false;
          }
      }
      

      }

      using System.Data;
      using System.Data.SqlClient;

      using System.Configuration;
      using System.Collections;
      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 right7image : System.Web.UI.Page
      {
      SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["transfer"].ConnectionString);

      string branchid =
      
      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      developerit wrote:

      clients those who are using windows7 and vista the are getting errors

      What error they are getting ?

      Cheers ! Abhijit Jana | MVP Web Site : abhijitjana.net | Follow Me @ twitter Read my Latest Article :Mastering Debugging in VS 2010

      1 Reply Last reply
      0
      • D developerit

        hi , iam using asp.net 2.0 with sql server 2000 in my site if iam using xp operating system all clients are able to upload the pictures but the clients those who are using windows7 and vista the are getting errors can you correct my code

        <%@ WebHandler Language="C#" Class="right7" %>

        using System;
        using System.IO;
        using System.Data;
        using System.Data.SqlClient;
        using System.Configuration;

        using System.Web;
        public class right7 : IHttpHandler {

        public void ProcessRequest (HttpContext context) 
        {
            string branchid = "";
        
            //if(context.Session\["branchid"\]!=null)
            if (context.Request.QueryString\["branchid"\] != null)
        
        
                branchid = context.Request.QueryString\["branchid"\];
            else
                throw new ArgumentException("No parameter specified");
        
            context.Response.ContentType = "image/jpeg";
            Stream strm = ShowImage(branchid);
            byte\[\] buffer = new byte\[4096\];
            int byteSeq = strm.Read(buffer, 0, 4096);
        
            while (byteSeq > 0)
            {
                context.Response.OutputStream.Write(buffer, 0, byteSeq);
                byteSeq = strm.Read(buffer, 0, 4096);
            }
            //context.Response.BinaryWrite(buffer)  
        }
        public Stream ShowImage(string branchid)
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings\["transfer"\].ConnectionString);
            string sql = "SELECT imgright7 FROM tblImages WHERE BranchId = @BranchId";
            SqlCommand cmd = new SqlCommand(sql, con);
            cmd.CommandType = CommandType.Text;
            cmd.Parameters.AddWithValue("@BranchId", branchid);
            con.Open();
            object img = cmd.ExecuteScalar();
        
            try
            {
                return new MemoryStream((byte\[\])img);
            }
            catch
            {
                return null;
            }
            finally
            {
                con.Close();
            }
        }
        
        public bool IsReusable {
            get {
                return false;
            }
        }
        

        }

        using System.Data;
        using System.Data.SqlClient;

        using System.Configuration;
        using System.Collections;
        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 right7image : System.Web.UI.Page
        {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["transfer"].ConnectionString);

        string branchid =
        
        T Offline
        T Offline
        Tej Aj
        wrote on last edited by
        #3

        check this post http://opexsolution.com/forum/viewtopic.php?f=15&t=59&p=180#p180[^]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups