ASP.NET MVC 4 - Default connection string improperly escaped - by Nick Strupat

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 740623 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 5/4/2012 11:06:51 AM
Access Restriction Public


The initialization of the connection string in a new ASP.NET MVC 4 project is the following

Database.DefaultConnectionFactory = new SqlConnectionFactory("Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True");

The "\v" is not escaped and will yield an incorrect connection string. This string should be escaped properly. I have provided two possible solutions in the 'expected results' section below.
Sign in to post a comment.
Posted by Microsoft on 5/12/2012 at 5:26 PM
Hi Nick,

Thanks for filing this bug. We have corrected this error by properly escaping the \v. It was a last minute change for the Beta and we missed it! For now there are two workarounds I can think of:
1. Add an extra \ to it, so that it becomes \\v
2. Prefix the string with an @ so that it looks like @"connection string here"

Our next release will have this issue corrected.

Posted by MS-Moderator10 [Feedback Moderator] on 5/7/2012 at 8:54 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by MS-Moderator01 on 5/4/2012 at 11:43 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(