Weird error with VS 2005

In case some people don’t believe I have issues with VS 2005 maybe you can help me there. Check my article too.
Look at this screen grab (click to enlarge) and tell me what I am doing wrong (works perfectly fine under VS 2003).
You can see a basic <a> tag link to go to another folder. Look that VS 2005 don’t like it, same with images tags too.

error with VS 2005

 

14 Comments

  • That seems odd to me too.



    Have you tried to reference the page from root &quot;&lt;a href=&quot;/members/books.aspx&quot; /&gt;&quot;?

  • Update: I try also in Designer mode to see in the properties of the tag (HREF section) how the designer will reference my link. Got it wrong because it added the relative path ../members/books.aspx. Just in case you didn't notice, this is a user control page so the url is related to the parent page not the control itself. It has to be members/books.aspx

  • Chris I can't reference from the root becuase my project is under a virtual directory not at the root. Of course I can use an absolute path but this make nonsense for me, and I repeat I have the same behavior with IMG tags too. Might be something wrong in the configuration files somewhere, but I swear I use VS out of the box :-)

  • &lt;a href=&quot;~/members/books.aspx&quot; /&gt;Foo&lt;/a&gt;

  • Thanks Raj but wrong :-)

    First you forget the runat=server attribute and the project is under the root not at the root in a virtual directory. I know it sounds strange but in this case it's resolved on my local machine as localhost/members/books.aspx

  • Apologies Raj works now with the ~. It was not working before! But my problem stay the same, I don't see myself changing all the tags to include a runat, this can have serious implication regarding the performances. After all I just want a simple HTML tag nothing more.

  • Don't get me started about the less that stellar error reporting in VS.Net 2005. right now I have 2 valid errors, that I fixed 2 hours ago...but they are still showing up (build works fine though).



    I'm using an EAP of Resharper, so I keep telling myself it's just that...

  • The error is not a compilation error but rather an HTML validation error. It will show up in your error task list if you have the page open in source view, but it does not break build or compilation scenarios. If you do a F5 to run the app or choose Build-&gt;Build Web Site you'll see it does not stop those from occuring.



    The reason it doesn't show up in VS 2002 or 2003 is because the html editor there didn't do rich validation or error checking. This meant a lot of errors that could have been caught in the IDE were only found by running the site. We choose to show these errors now in the IDE to make them easier to spot -- as I said above these html validation errors do not prevent the app from running or compiling, they are task list errors you can choose to either fix or ignore if you want.



    If you don't want to ignore the error (which you can do), or fix the error using the suggestions I made above (which would make your app less brittle), and instead just want it to disappear entirely -- then go to your Tools-&gt;Options menu and under Text Editor-&gt;Html-&gt;Formatting-&gt;validation uncheck the &quot;show errors&quot; option for html. This will give you the same VS 2002/2003 experience.



    Hope this helps,



    Scott

  • This is due to the fact the VS references files with case-sensitivity.



    If you change the link to &quot;&lt;a href=&quot;~/Members/Books.aspx&quot;&gt;&quot; it should be fine!

  • Your specification was invalid... The environment told you your specification was invalid. If you don't want the environment to report such errors, turn it off.

  • Paschal,



    The validation just happens when the ASPX or ASCX pages are loaded. Either just close the page and compile, or turn that feature off as scott has suggested.



    Note that the tool is just trying to help you....In other words, if you keep using a relative path, your user control will *already* (as in with VS 2003) be broken if you drag it onto another web form in a different directory.



    I think this is a good thing. The tool is pointing out an error, that it cannot resolve that path. If you really are building a user control that will only work if dropped on a page from a certain directory....probably place the control in that same directory and put a big note in your source/html code that it will break if you use it from a different directory.



    See how nice 2005 is....helping you with these things.



    ;-)

  • Thanks guys but maybe I don't explain correctly or I am really stupid. In VS 2003 if I use in a control saved in a subfolder a link to another folder like this href=&quot;Members/Books.aspx&quot; it works perfectly and this is my choice to use it like that! It works because the aspx page including the control is at the top of the page. I expect the same minimum compatibility with VS 2005. I don't care if I will have issues if I move the control elsewhere, I just want the same level of understanding from VS 2005! After all I use this method since the old time of ASP and include files! Now I am talking about an error, and in my case when I call any page with errors like that all the control is not rendered at all. So now I have to modify all the dozen of controls just to make happy VS 2005. Talk about migration and compatibility, this is absolutly non sense.

  • Pascal:

    I agree 100% with you. i think your code is valid, and VS.Net simply doesn't get it. It's a mistake for this to show up as an error, perhaps a warning would be better.

  • Paschal



    It's quite possible your control is not rendering for some other reason, some other bug in your code.



    Pete

Comments have been disabled for this content.