Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Red xRed x's retrieving from sql in DNN
Previous
 
Next
New Post
6/7/2007 5:38 PM
 

I'm retreiving images from SQL and I get and display the images fine in a regular web.  When I use the same code in DNN I get red x's.  Any ideas? Yes, the files must be in the sql server.

Here is the code.  This works outside DNN red X's in it.

 <asp:Image ID="Image1" runat="server" ImageUrl='<%# "image1.aspx?imageid=" + Eval("ImageId") %>'
            Style="position: relative" /><br />

the contents of image1.aspx

public partial class Image1 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       
            string imageid = Request.QueryString["imageid"];
            string sqlText = "Select Picture1 from Pictures where PictureId = " + imageid;

            SqlConnection sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["SiteSqlServer"].ToString());
            SqlCommand sqlCommand = new SqlCommand(sqlText, sqlConnection);

            sqlConnection.Open();
            SqlDataReader dr = sqlCommand.ExecuteReader();

            if (dr.Read())
            {
                byte[] image = (byte[])dr["Picture1"];
                Response.ContentType = "image/jpeg";
                Response.BinaryWrite(image);
            }

            sqlConnection.Close();

    }
}

 

What would make this display fine in any other web but red x in dnn?  When I debug it in DNN I can see image is not null

 

 
New Post
6/7/2007 6:07 PM
 

I think this is related to the FriendlyUrls in DNN. Your "image1.aspx?imageid=" cannot be found on the current path so you see the red x. Try adding the full path in front of it:

"/Desktopmodules/yourmodule/..."


Vicenç Masanas
Banyoles, Girona - Spain

Disgrafic.com    PSD to DNN
 
New Post
6/8/2007 9:56 AM
 

It's the same with current path or even if I browse to the file directly http://sitename/desktopmodules/modulename/image1.aspx?imageid=4  I still get red x but outside DNN I get a picture.  It's being found because I can see it in the debugger. If I right click on the red x in DNN I also get the full path to image1.aspx. It's driving me crazy.

 
New Post
6/8/2007 10:35 AM
 

Figured it out. It's Visual Studio.  Appears fine same module on live server.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Red xRed x's retrieving from sql in DNN


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out