I'm fairly new to ASP.NET and of course happened to stumble some strange problem.
Problem is very popular, but none of the replies I found worked for me.I have a simple image:
<asp:Image ID="userImage" runat="server" ImageAlign="Right" />
And in codebehind:
If Not Session("selecteduser") Is Nothing Then
userImage.ImageUrl = "~/showphoto.aspx?user=" & Session("开发者_高级运维selecteduser")
End If
And the image doesn't change. It doesn't even fire up the showphoto.aspx code. The property is changed (because next time i step into it, it's changed), but showphoto is never fired.
I'm aware of image caching issues, but I can't get even one image, not mentioning have it changed. For sure there's a very simple explanation, but I'm fighting with this for 2 days now to no avail.
I think the problem may be one of the following:
There is nothing in the session object "selecteduser" which might cause that the imageurl property not set. ( Resolution: debug your code to confirm that there is a session object )
The image url is being setted but the image is not changed which might be a problem of browser caching. (Resolution: Append the current date time to the list of query string parameters to force the browser to load the new image).
"showphoto.aspx" is a page and not an image so it return html code which is not translated to image. (Resolution:Change the content-type property of this page to be image
精彩评论