views:

32

answers:

1

Hi, I have a problem using ASP MVC with C#. When I create an aspx page with a strongly typed inherit I received the following error:

Server Error in '/' Application.

Illegal characters in path. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Illegal characters in path.

Source Error:

Line 60: ///

Line 61: /// Connection String

Line 62: public ObjectContext(string connectionString)

Line 63: : base(connectionString, "Entity")

Line 64: {

I cannot solve this problem, in any webpage I create I received the same problem. I checked my web.config information on the internet but its ok, I re created the ado entity connection but the same happens.

This is my connection string on web.config:

add name="Entity" connectionString="metadata=res:///Models.model.csdl|res:///Models.model.ssdl|res://*/Models.Model.msl;provider=System.Data.SqlClient;provider connection string="Data Source=SOURCE\SQL;Initial Catalog=db;Persist Security Info=True;User ID=user;Password=password;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />

thank you so much!.

+1  A: 

I can see that your connection string looks wrong. Should be ....metadata=res://*/Models.model.csdl|res://*/Models.model.ssdl....

Just so you know the metadata represents this:

metadata=res://{assembly}/{namespace}.{filename}.csdl|res://{assembly}/{namespace}.{filename}.ssdl|res://{assembly}/{namespace}.{filename}.msl;

You can put the assembly name or the wildcard *, which it looks like you're missing on your csdl and ssdl

BritishDeveloper
thank you for your answer. I try to shorten the info, the real path is metadata=res://*/Models.DataLogic.Data.nameModel.csdlI´m confused on the fact that I cannot declare the entity access on controllers or class using that route. something simple like private entitymodel db = new entitymodel(); is not possible if I dont place the edmx file on Models. directly instead of Models.Datalogic.Data.edmxI´m really confused, I will check. Thank you so much for your time.
sebastian_h