Getting error in web.config file.

Posted by Sreekanthv5 under ASP.NET on 6/23/2012 | Points: 10 | Views : 2302 | Status : [Member] | Replies : 2
In my web.config file i have given like this.
<system.web>
<rolemanager enabled="true" />
<authentication mode="Forms" />
<compilation debug="true" targetframework="4.0" />
</system.web>

<system.web>
<sessionstate mode="SQLServer">
sqlConnectionString="mycon"
sqlCommandTimeout="30"
cookieless="UseUri"
timeout="20"&gt;
</sessionstate>

</system.web>
<connectionstrings>
<add name="mycon" connectionstring="Data Source=Sreekanth; Integrated Security=True; Database=Northwind" />
</connectionstrings>


error is
The sqlConnectionString attribute or the connection string it refers to cannot contain the connection options 'Database', 'Initial Catalog' or 'AttachDbFileName'. In order to allow this, allowCustomSqlDatabase attribute must be set to true and the application needs to be granted unrestricted SqlClientPermission. Please check with your administrator if the application does not have this permission.

I want to access the connection string in my application.




Responses

Posted by: Rajkatie on: 6/23/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
You have to set allowCustomSqlDatabase attribut in <sessionstate> section. For more information refer following link
http://msdn.microsoft.com/en-us/library/h6bb9cz9.aspx


Rajesh Patel
.Net Trainer(MSCD | MCT | MS)
Brainbench (Asp.Net 4.5 and C# 5.0)

Sreekanthv5, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muralidosscm on: 6/25/2012 [Member] Starter | Points: 25

Up
0
Down
Database=Northwind is microsoft database thats why that message showing..........
give your database name

Regards
Muralidoss M

Sreekanthv5, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response