using (WallpaperEntities4 ctx = new WallpaperEntities4())
{
string UName = Convert.ToString(Session["UserName"]);
var query = (from c in ctx.Users
where c.UserName == UName
select new
{
c.Image,
c.Name,
c.UserName,
c.EmailID,
The codes are correct generally. I think you might have a problem about displaying the image. That way, we might need to dig more for storing the image.
If you upload the image to the server and store the path of the image in the database, then you just need to confirm the path is correct.
However, if you store the image with binary/based64 encoded format in database, you might need to add a prefix "data:image/png;base64, " as below.
ASP.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
If you still have any problem, feel free to let me know.
Best regards,
Sean
ASP.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
Member
11 Points
32 Posts
show image of user after successful login in asp.net Entity Framework
Aug 05, 2020 05:18 AM|guestadmin@nirvriti.com|LINK
when user register he/she upload his/her image after that user image is display in profile form...
here is my code.
<asp:Image runat="server" ID="imgPhoto"
ImageAlign="Top" Width="118" Height="118" />
using (WallpaperEntities4 ctx = new WallpaperEntities4())
{
string UName = Convert.ToString(Session["UserName"]);
var query = (from c in ctx.Users
where c.UserName == UName
select new
{
c.Image,
c.Name,
c.UserName,
c.EmailID,
}).FirstOrDefault();
if (query != null)
{
imgPhoto.ImageUrl = query.Image;
TxtName.Text = query.Name;
lblUserName.Text = query.UserName;
TxtEmailID.Text = query.EmailID;
Contributor
3010 Points
886 Posts
Re: show image of user after successful login in asp.net Entity Framework
Aug 06, 2020 03:04 AM|Sean Fang|LINK
Hi Nirvriti Sharma,
Could you please specify what the problem is?
The codes are correct generally. I think you might have a problem about displaying the image. That way, we might need to dig more for storing the image.
If you upload the image to the server and store the path of the image in the database, then you just need to confirm the path is correct.
However, if you store the image with binary/based64 encoded format in database, you might need to add a prefix "data:image/png;base64, " as below.
imgPhoto.ImageUrl = "data:image/png;base64," + base64string;
Hope this can help you.
Best regards,
Sean
Contributor
3010 Points
886 Posts
Re: show image of user after successful login in asp.net Entity Framework
Aug 17, 2020 11:21 AM|Sean Fang|LINK
Hi Nirvriti Sharma,
Have your problem solved?
If you still have any problem, feel free to let me know.
Best regards,
Sean
Member
11 Points
32 Posts
Re: show image of user after successful login in asp.net Entity Framework
Aug 17, 2020 11:37 AM|guestadmin@nirvriti.com|LINK
Sean Fang
thanx for the concern...but i solve this