Posts Tagged ‘asp.net’

Weird bug causes Internet Explorer to toss its cookies

Check this out…if you create an <img> tag with an empty src attribute, it might cause Internet Explorer to dump your site’s cookies.  I’ve only tested/experienced this on IE8, so I don’t know all the versions that are affected.  I also don’t know if this happens on all web forms, or just those generated by ASP.Net.

Correction: actually, what’s happening is this:

“Blank src attribute causes IE to load the default document.”  …and in the case of the particular application that I was working on, going back to the default page caused my cookie to get overwritten.

See the comments on http://msdn.microsoft.com/en-us/library/ms535259%28v=vs.85%29.aspx

“Connection to the server has been reset…” problems with ASP.Net after installing SQL Express 2008

The fix: I put these two attributes in the <pages> element in your web.config file…

enableEventValidation=”false” viewStateEncryptionMode=”Never”

Found the solution here after much installing/reinstalling/updating/frustration/hassle/crying/thoughts-of-giving-up-on-web-development-and-becoming-a-security-guard-again:

http://siderite.blogspot.com/2007/08/aspnet-connection-to-server-has-been.html

Now here’s the interesting thing…I removed the two attributes and saved web.config to confirm the fix.  My site still worked.  So I did an iisreset to make doubly sure, and voila – the site broke again without those attributes.  So, as is often the case when you’re trying to convince a laptop with Vista Home Premium that it’s actually a web server, beware false positives, false negatives and any other results you might get.  Clear your browser cache and do an iisreset whenever you fiddle with this kind of stuff.

So why did this work?  I managed to track down the spot where it was breaking, and it was inside a component that’s part of the third-party e-commerce suite we’re using.  It was obviously trying to do some data access that SQL 2008’s components didn’t like.  Why would the ASP.Net forms stuff affect it?  Black Box hoodoo voodoo reasons, I guess.  Was it the attributes that actually fixed the problem, or did my web.config just need to be fiddled with so the site would recompile in a certain way?  Sadly, I am too busy to dig into that mystery.

edit: removed a space from the attributes.

CrystalDecisions.Web – could not load assembly, etc.

VS 2008 givin’ ya grief cuz it can’t find that nifty Crystal Reports viewer?  You need to install Crystal Reports Basic 2008!  You know…the one that is supposedly packaged with Visual Studio 2008?  The “embedded” one?  Yeah!  That one!

Here’s where I finally tracked down my copy:
https://smpdl.sap-ag.de/~sapidp/012002523100009351512008E/crbasic2008sp1.exe

That long string of numbers + E is probably a session number or something.  If it asks for an identity, just smile and nod and click OK.  Why they put free stuff under an https site is beyond me.  But then again, so is the fact that I have to go to some German website to download something that’s supposed to come with my IDE.

I really had to dig for this one.  Some folks might be lucky enough to have an installation file in “C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5”, according to this thread on MSDN.

There’s also “C:\Program Files\Microsoft Visual Studio 9.0\Crystal Reports\CRRedist\IA64” but  I ain’t got one of them fancy 64 bit processor doodads.

Intellisense fix for Visual Studio 2008 ASP.Net pages

Somehow my settings got jacked up on VS 2008 and Intellisense didn’t work when viewing editing aspx pages in “source” mode (when you’re editing HTML and web form tags).  It coulda been a service pack install, it coulda been some of the paranoid junk that corporate America loads onto work computers nowdays, but regardless of the cause I was hosed.  I tried everything.

I finally found a post that led me to an answer while looking digging through the offical ASP.Net forums.  The proposed fix on the forum didn’t solve my particular issue (the topic was intellisense in XML files), but one poster mentioned switching the editor by right-clicking and selecting “Open with…”.  I remembered seeing that and tried out a couple of different editing modes.  It turns out that the “Web Form Editor” is the one to use.  I set that mother as my default and now I’m plugging away at aspx pages again.

Soooo…in VS 2008’s Solution Explorer, right-click on an aspx page you’d like to edit, then select “Open with…”.  Choose “Web Form Editor” and click the “Set As Default” button.  Done.

ORA-01036: illegal variable name/number parameter in ASP.Net app

My Oracle chops are way outdated, and, being a fan of business objects and/or a genuine Data Access Layer, I’m not used to working with typed datasets in asp.net.  So when I got the above error I was pretty stumped, and I started using some obscene anti-Oracle phrases to name a few test variables to figure out wtf was going on.

Eventually I figured out that it’s not a good idea to just enter parameters into a Select method via the Properties window, even though Visual Studio will cheerfully let you do that.  If you don’t have the parameter referenced in the actual SQL of the select method, you’re gonna get the above message when you try using it.  So…

In your Select method’s SQL, be sure to add “WHERE ID = :ID” and Visual Studio should pick up on that and make a parameter for you.  Too bad it doesn’t work the other way around.

When I was trying to find info on this error I found lots of talk about update parameters and other causes, but didn’t see anything related to this particular circumstance.