Click here to Skip to main content
15,899,314 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Using Ajax control in User Control (ascx) Pin
-Muc_21-Jun-10 11:20
-Muc_21-Jun-10 11:20 
GeneralRe: Using Ajax control in User Control (ascx) Pin
Not Active21-Jun-10 11:42
mentorNot Active21-Jun-10 11:42 
GeneralRe: Using Ajax control in User Control (ascx) [modified] Pin
-Muc_21-Jun-10 11:45
-Muc_21-Jun-10 11:45 
QuestionIf i Close to browser Pin
Rajeshwar Code- Developer21-Jun-10 2:33
Rajeshwar Code- Developer21-Jun-10 2:33 
AnswerRe: If i Close to browser Pin
Venkatesh Mookkan21-Jun-10 20:12
Venkatesh Mookkan21-Jun-10 20:12 
QuestionHow solve this the status code returned from the server was: 504 in asp.net 2005 with using of AJAX Pin
vidyashankar21-Jun-10 1:35
vidyashankar21-Jun-10 1:35 
AnswerRe: How solve this the status code returned from the server was: 504 in asp.net 2005 with using of AJAX Pin
Ankur\m/21-Jun-10 1:53
professionalAnkur\m/21-Jun-10 1:53 
Questionimages are not uploading in windows7 and vista using asp.net with c# Pin
developerit21-Jun-10 1:32
developerit21-Jun-10 1:32 
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 = "";
    
    protected void Page_Load(object sender, EventArgs e)
    {
        branchid = Session["UserName"].ToString();
        if (IsPostBack == false)
        {

            Image1.ImageUrl = "right7.ashx?BranchId=" + branchid;
            Image2.ImageUrl = "right7old.ashx?BranchId=" + branchid;
        }


    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        Response.Redirect("Images.aspx");
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //update
        //1st copy using ptr
        SqlCommand cmdptr = new SqlCommand("copyprevimgr7", con);
        cmdptr.CommandType = CommandType.StoredProcedure;
        con.Open();
        cmdptr.Parameters.AddWithValue("@BranchId", branchid);
        cmdptr.ExecuteNonQuery();
        con.Close();




        //2nd newlybrowse once updateleft1image

        SqlCommand cmdupdate = new SqlCommand("updateright7", con);
        cmdupdate.CommandType = CommandType.StoredProcedure;
        con.Open();
        cmdupdate.Parameters.AddWithValue("@BranchId", branchid);

        if (FileUpload1.HasFile)
        {
            FileInfo left1info = new FileInfo(FileUpload1.PostedFile.FileName.Trim());
            byte[] left1content = new byte[left1info.Length];
            FileStream left1stream = left1info.OpenRead();
            left1stream.Read(left1content, 0, left1content.Length);
            left1stream.Close();
            cmdupdate.Parameters.AddWithValue("@imgright7", left1content);

        }


        cmdupdate.Parameters.AddWithValue("@noter7", TextBox1.Text);


        if (cmdupdate.ExecuteNonQuery() != 0)
        {
            con.Close();
            clsdatasettransfer.ShowAlertMessage("Updated.....");
            TextBox1.Text = "";
            System.Threading.Thread.Sleep(2000);
            Image1.ImageUrl = "right7.ashx?BranchId=" + Session["UserName"].ToString();
            Image2.ImageUrl = "right7old.ashx?BranchId=" + Session["UserName"].ToString();

        }
        else
        {


            clsdatasettransfer.ShowAlertMessage("Updatefailed");

        }

    }
}

AnswerRe: images are not uploading in windows7 and vista using asp.net with c# Pin
Abhijit Jana21-Jun-10 2:13
professionalAbhijit Jana21-Jun-10 2:13 
AnswerRe: images are not uploading in windows7 and vista using asp.net with c# Pin
Tej Aj21-Jun-10 3:23
Tej Aj21-Jun-10 3:23 
QuestionMessage Removed Pin
21-Jun-10 0:13
KishoreT21-Jun-10 0:13 
AnswerRe: Page navigation using javascript Pin
KishoreT21-Jun-10 2:08
KishoreT21-Jun-10 2:08 
QuestionIIS Requires .Net Framework 3.5 Pin
Ravindra Bisen20-Jun-10 22:54
Ravindra Bisen20-Jun-10 22:54 
AnswerRe: IIS Requires .Net Framework 3.5 Pin
Abhijit Jana20-Jun-10 23:38
professionalAbhijit Jana20-Jun-10 23:38 
QuestionWhat is Boxing and unBoxing Pin
S.Mahesh20-Jun-10 22:52
S.Mahesh20-Jun-10 22:52 
AnswerRe: What is Boxing and unBoxing Pin
Ankur\m/20-Jun-10 23:20
professionalAnkur\m/20-Jun-10 23:20 
AnswerRe: What is Boxing and unBoxing Pin
koolprasad200320-Jun-10 23:35
professionalkoolprasad200320-Jun-10 23:35 
AnswerRe: What is Boxing and unBoxing Pin
Abhijit Jana20-Jun-10 23:40
professionalAbhijit Jana20-Jun-10 23:40 
AnswerRe: What is Boxing and unBoxing Pin
Sandesh M Patil21-Jun-10 1:05
Sandesh M Patil21-Jun-10 1:05 
Questionshow picture with mouseover Pin
ptvce20-Jun-10 22:00
ptvce20-Jun-10 22:00 
AnswerRe: show picture with mouseover Pin
Ankur\m/20-Jun-10 23:22
professionalAnkur\m/20-Jun-10 23:22 
GeneralRe: show picture with mouseover Pin
ptvce21-Jun-10 0:03
ptvce21-Jun-10 0:03 
AnswerRe: show picture with mouseover Pin
Ankur\m/21-Jun-10 0:22
professionalAnkur\m/21-Jun-10 0:22 
GeneralRe: show picture with mouseover Pin
ptvce21-Jun-10 1:18
ptvce21-Jun-10 1:18 
GeneralRe: show picture with mouseover Pin
Ankur\m/21-Jun-10 1:22
professionalAnkur\m/21-Jun-10 1:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.