Category Archives: IIS

[RESOLVED] embedding image not displaying in emaill using


I am trying to display an embed an image within the body of an email. The is sent, however without the image.

Below is the code:

Dim mail As New MailMessage()


mail.From = New MailAddress("")

mail.Subject = "Test Email"

Dim Body As String = "<b>Welcome to!!</b><br><BR>Online resource for .net articles.<BR><img alt="""" hspace=0 src=""cid:imageId"" align=baseline border=0 >"

Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString(Body, Nothing, "text/html")

Dim imagelink As New LinkedResource(Server.MapPath(".") & "\uploads\CIMG1443.JPG", "image/jpg")

imagelink.ContentId = "imageId"

imagelink.TransferEncoding = System.Net.Mime.TransferEncoding.Base64



Dim smtp As New SmtpClient()

smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis
smtp.Host = ConfigurationManager.AppSettings("SMTP")
smtp.Port = 587
'smtp.EnableSsl = True

smtp.Credentials = New System.Net.NetworkCredential(ConfigurationManager.AppSettings("FROMEMAIL"), ConfigurationManager.AppSettings("FROMPWD"))


In the body of the email only the following is display:

Welcome to CodeDigest.Com!!

Any idea how I can get the CIMG1443.JPG displaying?



is  Image is there on The path Which Your Specifiying?

Dim imagelink As New LinkedResource(Server.MapPath(".") & "\uploads\CIMG1443.JPG")

imagelink.ContentId ="test"


U send Html Image Tag then define image in that

Example :- --message--<img src=""/>


above link may be good Resource for you.

Blank ASPX page OR Page not being rendered

I have an application that was built on IBS V1, its worked well over the years.  It was previously done with NotePad, I'm now using VS 2005.

The problem I'm experiencing is that some ASPX pages are being rendered as blank.  When I view sourcecode in Notepad, all the HTML is there, but nothing is displayed and there is nothing to select.  If this was happening to all pages, I could solve it. It appears to be totally random. I have two pages which are identical except for the parameters, one is displayed okay, the other is just blank.

 This is happening when I view in Localhost in IE (tried 6 & 7 same results).

 When I was first working in VS2005 when I switched to design mode it was also blank, but this seemed to correct itself. None of the pages that are NOT being displayed is giving any problem or reporting any error in VS2005 and the same with Web Developer 2008.


 I would sujest you check your stylesheet or styles on the page incase you have display: none; or anything else like that set, best way to test is remove all style sheet reference.

 Possibly even copy the html from source view then remove styles and css file reference and test again as this eliminates serverside code.

What happens when debugging in VS? same thing?



Its not style sheets,  as I said I have two pages which are identical apart from a parameter, one page works and the other doesn't.

 It has something to do with the Page Compiler.

 But if the page is showing source code then it should be displayed...

Could you show the offending page code to try and replicate?



The problem has been identified. Its Internet Explorer.  All other browsers display the page.  IE previously had displayed the page, no it displays blank (but does serve up the code) so its IE.

This has happened to a number of pages, and the pages worked up until something makes IE not render the page.

 IE was the last thing I suspected, I've spent over 70 hours on this problem.

I've done some more testing, and Firefox and Safari both work flawlessly with the pages, that IE draws blank.  Opera doesn't work either, but Opera doesn't render the menus either, which all other three browsers do.  Opera has worked fine on my DNN sites, but it hates this site which was built on IBS SDK ASP.NET Framework V1.1.

 I like both Firfox and Safari, but for the last 6 years we have been telling everyone that our site only supports IE. We are looking very foolish.

there is no doubt i can fix your issue if you give me some code....  Without code and without knowing exactly what you are dealing with we are all just tossing random guesses at what the heck might be going on.....  I was one of the rebels when it came to upgrading to VS2005, I was upgrading everything my company ever wrote to VS2005 when the first beta came out...  So let me tell you i have seen my share of issues with code that should have worked out of the box....  If you post some code or im me I'm sure we can fix ur issue i a lot less hours than u've already spent.....

Its not VS. This site was built using IBS SDK, which means it has full source code .aspx pages which are compiled as accessed. There are DLL Classes which handle data, they all work fine. They are linked via Framework V1.1 with the vbc compiler. And since the pages are rendered correctly in FireFox and Safari without ANY problems. It cannot be an Error.

You are right, there has to be something that is happening as I edit the pages but what, I'm only making changes to pages or controls. None of the Controls have been rendered blank. So it has to be something in the ASPX page that IE doesn't like.  Two of the pages which are giving me the same problem are totally different. Both worked until there was a change, the change has not caused any errors (I use VS 2005 as my editor, it has no problems on either of these pages. If I deliberetly create errors, it finds them. So the page gets compiled properly.  It has to be something in the way IIS serves up the page, that only IE doesn't like.

See IE Newsgroup for more info.  I tried loading the code from right click view source, AFTER I saved it to a file.  When I load the file into Firefox, it displays. When I load thge file into IE it displays nothing. So this is a PURE Internet Explorer issue.

The problem is the following;

 in the following;

    <title title="Edit Capital Income" />
    <link rel="stylesheet" href="../Portal.css" type="text/css" />

If I remove the following line, it all works.

    <title title="Edit Capital Income" />

 NOW the pages that work ALSO have the title, which was insisted by VS and IE did not object.



 Its more interesting as;

    <title title="Pupil Teacher Ratios - Primary"></title>

The above will work, but the following doesn't

 <title title="Edit Capital Income" />



 Wow that's an interesting one! I knew it wasn't serverside but i would never have removed the title!



The reason I started this thread was I couldn't find any other Posts on this problem.  I just tried again, no luck finding this Thread using Search.  I tried the exact search for "rendered as blank"  having copied it from my original post. It found two pages of Posts, but not this thread.

It was suggested in the IE newsgroup, that IE behaved properly (in that it had a problem with the way the tag was written, the person suggested that there is only one way to write a title trag and that is <title></title>.  If that is the case then VS-2005 needs to reflect this.  It appears a bit strange that VS and IE use a different set of rules to interpret HTML.

i had a similar issue, where the designer wasn't rendering the UI, although there was plenty of html etc. I removed the style tag in the <head> tag and voila, the UI shows up. 

I stumbled on this thread with the exact same problem with <TITLE/>. Appreciate finding this. FYI, I've found opening and closing an IFRAME in a single tag also causes major problems, iirc, elements open and closed with a single tag have also caused the web postback method to be "not found". As a rule, all elements I create an open tag and close tag for, even if empty.

[RESOLVED] Url Routing in .net 4.0 and 3.5


    I am trying to implement Url routing in 4.0 by following example

Works fine..

Now the scenario is that i have gridview with object datasource which accepts  "Name" as query string.

<asp:gridview ID="Gridview1" runat="server" DataSourceID="ObjectDataSource1"></asp:gridview>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
            OldValuesParameterFormatString="original_{0}" SelectMethod="Hello"
                <asp:QueryStringParameter Name="value" QueryStringField="Name" Type="String" />

i tried this code. But i couldn't get the value in QueryString Field??

How to handle in this situation??


How to implement (the link example in net 3.5)??? because i don't  "


" attribute in  3.5. i have few existing application in 3.5 so thought of implementing there too.

Please guide me..This example in Link looks very easy and simple to handle


if your getting the value parameter from a pageroute you cant use querystring you should use a Route Parameter something like this.

<asp:RouteParameter RouteKey="Name" Name="value" Type="String" />

here you have another example how to do it...

In his example he is showing a codebehind example of how to access the route but in my example show you how to use it...

Hope it helps....

So you mean to say that i can't use querystring for passing value to objectsource???

How to pass the value objectsource then???

In your link you have shown it in 3.5 sp1. right??

But how to pass value on click of the Button? like he has shown in the example (mine link).

because in my scenario i have to pass value through querystring in many before i implement this feature i need to know how to access the value in pass it in objectdatasource and i don't want to use code behind.

i just checked on net

Is the

<asp:routeparameter name="category" RouteKey="category" />

not available for 3.5 sp1 in webforms???


Im not sure if it works in 3.5 I upgraded all my apps to 4.0 when implementing routing. 

If you use url routing the routeparameter replaces querystring. the querystring fetches the parameter after the questionmark (?) in the url and when using routing you dont have it. 


i could see few example with routing stuff in 3.5 but i am not able to get  <asp:routeparameter in my html.

indeed this is why I choose to wait with moving from URL rewrite to URL routing until I moved to ASP.NET 4.0 even finding answers for URL Routing 4.0 is difficult if your not working with MVC and want some info covering more than the basic's

this works with ASP.NET 4.0 but if the <asp:routeparameter is not supported in 3.5 I can only see that you have to declare it in codebehind if you want it to work with you SqlDataSource.


ok i made one small application in 4.0 now and implemented Url routing in that and hosted in IIS in my machine (win 7).

but i get an error

HTTP Error 404.0 - Not Found

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

now what could be the reason...when i am running with my visual studio then it works fine but when i hosted in IIS then i landed in above problem.

code i use.

protected void Application_Start(object sender, EventArgs e)

   void CustomRouteTable(RouteCollection routes)

            routes.MapPageRoute("Telugu", "Movie/Telugu", "~/Telugu/Telugu.aspx");

and in my default.aspx i kept a button on click of the button i wrote:

 protected void btnTelugu_Click(object sender, ImageClickEventArgs e)

now where am i going wrong????

please guide me...



HTTP Error 404.0 - Not Found

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.


It seems that IIS can not handle the UrlRoute when you enter the route url in browser.

I think you need to check the .NET framework version of the web site application pool. Url Route module need .NET 3.5 or upon.

Open the IIS manager and check it.

How to check the .NET version on IIS7:

Or add the UrlRoutingModule in web.config:

Check this link:

Hope this can help you.

Well do you have a file with the path ~/telugu/telugu.aspx because that is what you pointing at!

my guess would be that not...

 routes.MapPageRoute("Telugu", _ //routename

"Movie/Telugu", _  // you have hardcoded a virtual path and it is not expecting any paramenters parameter should be within {}

"~/Telugu/Telugu.aspx"); // this is the physical path...


let say you hav a file Movie.aspx in your root folder and you want to have a url that is movie / title .aspx it the route you should register is like this


and then for the url to redirect correctly with a given parameter it should be something like this  

RedirectToAction("title", "Movie"); // Action, Controller
RedirectToRoute("MovieRoute"); // Route name or like this if it is to a route without a parameter

hope it helped a little

[RESOLVED] Hosting 4.0 web application

i tried to implement url routing feature in 4.0 and tried to host in my machine in IIS. but i get an error.

HTTP Error 404.0 - Not Found

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

The code i used

protected void Application_Start(object sender, EventArgs e)

void CustomRouteTable(RouteCollection routes)

            routes.MapPageRoute("Telugu", "Movie/Telugu", "~/Telugu/Telugu.aspx");


and one in default.aspx page and on click of the button i wrote:

protected void btnTelugu_Click(object sender, ImageClickEventArgs e)

is it due to the page is kept inside the Folder in my application???

How to handle this scenario???

Thanks...Please guide me...

Are you certain that IIS is set up to host .net 4.0?

Check your IIS setttings. 

How to know whether the IIS is set up to host .net 4.0???

what are the steps?? Could you guide me???

I had made the application pool ->Asp.net4.0

should i select application pool-> Asp.net4.0 classic  ???

If you are using IIS 7 then yes, I always switch to Classic, while developing in VWD2008.

Classic has worked for me. 


Let me check into my server settings I will try to post later.



Under web sites in IIS 6, look at properties then on the folder tab, be certain you first have .net 4.0 available.

I don't know of setting in IIS6 App Pool for level.


i could solve the issue with applying the below code in my web.config file...

    <modules runAllManagedModulesForAllRequests="true">

      <add name="UrlRoutingModule"
                   System.Web.Routing, Version=,
                   PublicKeyToken=31BF3856AD364E35" />
      <!-- ... -->


      <add name="UrlRoutingHandler"
            verb="*" path="UrlRouting.axd"
                  System.Web, Version=, Culture=neutral,
                  PublicKeyToken=b03f5f7f11d50a3a" />
      <!-- ... -->


but i have two more issue....

1) i am not able to make url setting for Default.aspx page which is start page...i am also getting Default.aspx ( with extension)

2) how to navigate from HTML side??

Not required if you are running .net 3.5 it is backward compatible and will support 2.0


Can you help me to find out the ans for above 2 question which i posted ? 

Check out som eof the VIDEOS at this link

There are white papers and videos, search for the videos for a faster start.




  Thanks..I could get the issue resolved for ul and li with the help of ResolveUrl approach.