|
Till now I store the single image in binary format in database. Even , I can show the image from database single but I dont know how to show them in Grid.
The Article Link u given to me is for display image via using path of the Image not in binary format.So that is not helpful and Secondly I'm not here to get complete my work from others I just need a help or a point where i can solve my problem.
Thanks for urs kind interest
Amit
|
|
|
|
|
|
|
|
What is the error that you are getting??
|
|
|
|
|
He did not get any error because he dont know how to start..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
//upload image
public void OnUpload(Object sender, EventArgs e)
{
int len = Upload.PostedFile.ContentLength;
byte[] pic = new byte[len];
Upload.PostedFile.InputStream.Read (pic, 0, len);
SqlConnection connection = new
SqlConnection (@"server=INDIA INDIA;database=iSense;uid=sa;pwd=india");
try
{
connection.Open ();
SqlCommand cmd = new SqlCommand ("insert into Image "
+ "(Picture, Comment) values (@pic, @text)", connection);
cmd.Parameters.Add ("@pic", pic);
cmd.Parameters.Add ("@text", Comment.Text);
cmd.ExecuteNonQuery ();
}
finally
{
connection.Close ();
}
}
//load image
private void Page_Load(object sender, System.EventArgs e)
{
MemoryStream stream = new MemoryStream ();
SqlConnection connection = new
SqlConnection (@"server=INDIA INDIA;database=iSense;uid=sa;pwd=india");
try
{
connection.Open ();
SqlCommand command = new
SqlCommand ("select Picture from Image where id"], connection);
byte[] image = (byte[]) command.ExecuteScalar ();
stream.Write (image, 0, image.Length);
Bitmap bitmap = new Bitmap (stream);
Response.ContentType = "image/gif";
bitmap.Save (Response.OutputStream, ImageFormat.Gif);
}
catch
{
string strblandImagePath = Server.MapPath("");
strblandImagePath += "NoImg.gif";
FileStream FileBlandImagestream = File.OpenRead(strblandImagePath);
Bitmap bitImage = new Bitmap(FileBlandImagestream);
Response.ContentType = "image/gif";
bitImage.Save(Response.OutputStream, ImageFormat.Gif);
}
finally
{
connection.Close ();
stream.Close ();
}
}
modified 27-May-14 5:11am.
|
|
|
|
|
Hi all,
I am sending id to the another page but right now it is in readable format how to encrypt.
Thanks,
Amit Patel
|
|
|
|
|
This was enormously helpful code to me. I searched forever to find something this straightforward. You saved me many hours.
I wanted to add something another reader might find useful. I needed to add URL encoding so that the encrypted string would be ready for transport over HTTP. To do this (in vb.net) I add a reference to System.Web and use the HTTPUtility.URLEncode class to transform it into a string
Imports System.Web
strEncoded = HttpUtility.UrlEncode(strEncrypted)
So, the steps are:
1. Store a string of query parameters
2. Encrypt it using code above
3. Encode it with URLEncode
4. Send it through as query string (one string of apparently-random characters)
5. Receive it on the other side as one big query string
6. use HTTP.Utility.URLDecode to get it back to a regular string
6. Decrypt it using the code above
7. Write a routine to parse it out because you can't use Request.QueryString("AB") for this purpose. You have to come up with your own such as request_equerystring("AB"). Some code for this was written up in the following article on the subject that talks about the process but I could not get their encrypt and decrypt to work out-of-the-box in vb.net.
In my application, the data I am passing can only be obtained using a windows.form because it uses local data that is not brower-accessible. There are plenty of examples of ASP to ASP querystring passing out there where you can use server.transfer. But, this is the only simple-to-follow reference I could find to calling up a browser with encrypted query strings from vb.net (that worked on first try).
Encrypting the Information Passed From the Query String
|
|
|
|
|
Why not just provide the link to original content instead of copying and pasting it here?
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
its in my computer buddy in my txt file if you want thn i'll send it to you........and i am using it in my app....
|
|
|
|
|
bhavnvyas wrote: if you want thn i'll send it to you
No thanks.
Exactly same thing is right here[^]. As soon as I read "So, the steps are" it struck that I have seen it somewhere. Hence the reply.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
thank you very much.......
|
|
|
|
|
|
Encrypt with any encryption, Encode in base64 string and then pass to the querystring using UrlEncode.
Remember base64 is essential.
|
|
|
|
|
If you are just trying to make it not so obvious to the end user the ID that you are passing, then how about passing the data in a session variable ? It is not totally secure, but real easy to implement.
I don't believe in "over engineering" a solution. Keep things simple.
|
|
|
|
|
Hi,you can try
string.ToBase64String() and string.FromBase64String
modified 27-May-14 5:11am.
|
|
|
|
|
hii m using file upload control and am trying to upload image to my local folder(homeimg).
i have written code:
if (FileUpload1.HasFile)
{
FileUpload1.SaveAs("~\\homeimg\\" + FileUpload1.FileName);
Label1.Text = "File Uploaded: " + FileUpload1.FileName ;
}
else
{
Label1.Text = "No File Uploaded.";
}
it gives error and ask for root directory.as soon as give the path along with root directory the file gets uploaded.
Tell me how can i upload file to my local folder without using root directory.
thanks
|
|
|
|
|
Use Server.MapPath ex.
FileUpload1.SaveAs(Server.MapPath("~\\homeimg\\" + FileUpload1.FileName))
|
|
|
|
|
If you are using asp fileupload control then use this code..
tmpfile = Path.GetFileName(fbrwse.PostedFile.FileName);
iSubPath = Server.MapPath("..\\Documents\\");
if (!Directory.Exists(iSubPath))
{
Directory.CreateDirectory(iSubPath);
}
iSubPath1 = Server.MapPath("..\\Documents\\")+ "\\" + tmpfile;
fbrwse.PostedFile.SaveAs(iSubPath1);
|
|
|
|
|
thnks both logic works...
|
|
|
|
|
Hi,
Is there some way by which a web application design view should remain the same even if the resolution of the screen is changed?
Please reply
Thanks
Shankbond
|
|
|
|
|
use control width in percentage..
<td style="width: 15%">
<asp:Label ID="lblunat="server" Width="100%" text="Document Status: "></asp:Label>
|
|
|
|
|
treeview_SelectedNodeChanged event is not firing for the click of same node second time
|
|
|
|
|
That's Correct. Because you are not changing the node selection, you are just clicking it again.
Try treeview_TreeNodeExpanded and treeview_TreeNodeCollapsed instead.
|
|
|
|