Resolving the “Server Error in ‘/’ Application” Error in ASP.Net

I’ve been doing a lot more MVC in ASP.net lately and I’m running into all sorts of new challenges as I learn things like Razor scripting.

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: "-" is not valid at the start of a code block.  Only identifiers, keywords, comments, "(" and "{" are valid.

Source Error: 

Line 498:        msViewportStyle.appendChild(
Line 499:                document.createTextNode(
Line 500:                        '@-ms-viewport{width:auto!important}'
Line 501:                )
Line 502:        );

Well that’s not good, at the end of my body was a script block for bootstrap that was causing some issues. It was injecting some CSS using javascript and the @ symbol was being interpreted as an opening code block and then would error out because what it found after that was not valid code. This made sense, but was the solution? My first instinct was to escape it somehow, so I played with putting a backslash and then a double backslash in front of it, but that didn’t work. So I then went and researched what the escape character was, and found that there wasn’t a clear answer to this.

I found many posts on Stack Overflow and various other blocks and forums. Here’s a list of some of the suggestions I found:

@@
@:
@(“@”)
@Html.Raw(‘@’)

Those were just the more succinct options. Many people suggestion wrapping the whole script block inside of a razor code block and spitting it back out as just text. I really wasn’t sure which was the best option so I tried the @ option and found it did work for me, but if for some reason it doesn’t work for you try one of the others! Here’s what my code looked like in the end:

Line 498:        msViewportStyle.appendChild(
Line 499:                document.createTextNode(
Line 500:                        '@@-ms-viewport{width:auto!important}'
Line 501:                )
Line 502:        );

Tags: , ,

  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS
read comments

How to Remove a Hedgehog TDS License from Visual Studio

I recently setup a VM as a base point for all my Sitecore development. However it had so many of my licenses tied into it I was hesitant to share it with any of my co-workers even though it offered an excellent opportunity to have them hit the ground running on a project. So after I got everything setup how I wanted it and cloned that snapshot I went and started removing all the licenses for various pieces of software so there were no legal issues with sharing this VM, my hope was the first time they used it they’d have to grab their own licenses, enter those, and be off to the races.

But I couldn’t figure out how to remove the license for Hedgehog TDS. I would go into Visual Studio and then to Help -> View TDS License but when I cleared it out and hit Ok it told me it was not a valid license. Doh! It was validating an empty string :S So how would one go about removing the license without having to enter a new one? Regedit to the rescue!

All I had to do was delete all the values under the following location:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\HedgehogDevelopment\Sitecore Visual Studio Integration 2.0

After that I started back up Visual Studio and voila!

The license was cleared out and it was ready for me to input a new one.

Tags: , , , ,

  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS
read comments

SQL Server – Databases are Read-Only After Reattaching

I was moving some files around today and ran into this confusing issue. I had moved a Sitecore instance to a new folder but originally left the database in it’s old location, so I went and detached them in SQL Server Management Studio (SSMS) and then moved the files from on folder to another. After that I reattached them in SQL Server and found that they were all listed as Read Only.

No problem, I thought. I checked the folder and sure enough it was marked as Read Only, so I unchecked that and hit Ok. Same problem. I went back to the folder properties and it still said Read Only. From there I tried setting several inner folders and files individually but all of them had the same problem. How odd.

After a quick search and a few min on Stack Overflow I went and tried unsetting the Read Only property in SQL Server Management Studio and once again, no dice.

Eventually what worked for me was I went and gave my windows user full write access to the folder, since that’s who I was logging into SSMS as. At that point I still couldn’t unset the option in the Windows properties but I was able to go in and reattach it through SSMS and at that point it no longer listed them as read only.

Tags: , ,

  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS
read comments
 Page 2 of 71 « 1  2  3  4  5 » ...  Last »