|
|
I tried setting it. but did not work.
<connectionstrings>
<add name="DL" connectionstring="Data Source=(localdb)\v11.0;Initial Catalog=Sample;Integrated Security=True;Connection Timeout=30"
="" providername="System.Data.SqlClient">
|
|
|
|
|
Did you set ConnectionTimeout and/or CommandTimeout?
If so, what values did you use?
Can you post the code of where you set these values?
Have you further details of the exception? i.e. What object has timed out?
|
|
|
|
|
The timeout error happens with connection object. Initially, i didnt have connection timeout value in the connection string. after reading prev msg, i set the connection timeout value in connection string and the value of conn string is as follows
<connectionstrings>
<add name="DL" connectionstring="Data Source=(localdb)\v11.0;Initial Catalog=Sample;Integrated Security=True;Connection Timeout=30"
="" providername="System.Data.SqlClient">
Also, I tried to see the values of
Console.WriteLine("State: {0}", con.State);
Console.WriteLine("ConnectionTimeout: {0}",
con.ConnectionTimeout);
while there was a time out error thrown on con.Open(), I hover over the state and timeout value in the above statement to see the values, the timeout was set to 30 and the state was closed.
|
|
|
|
|
System.InvalidOperationException was unhandled by user code
HResult=-2146233079
Message=Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
Source=System.Data
StackTrace:
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
|
|
|
|
|
<connectionStrings>
<add name="DL" connectionString="Data Source=(localdb)\v11.0;Initial Catalog=Sample;Integrated Security=True;Connection Timeout=30"
providerName="System.Data.SqlClient" />
</connectionStrings>
|
|
|
|
|
|
Thank you for your message. I will give you the clear picture of what the issue is.
I have written a small app to test MVC. In my application, I created MVC project and used View and controller from the MVC project itself but for the model, I created a class library project and a class within that project will query the database using ADO.net and get the details and store it in an object and the object would be passed to MVC application.
In this application only, I am not able to fetch the data from the database. I used localdb from the sql server bundled with VS2013.
I created a separate console application and tested the database access. It works perfectly fine. I get back the response from the database.
|
|
|
|
|
How/where to set the Anti-MIME-Sniffing header X-Content-Type-Options to 'nosniff' for all aspx pages
|
|
|
|
|
Probably the best is to add it in your IIS, it will be there for application you ever write!
If it's not an option, use web.config, like this:
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-Content-Type-Options" value="nosniff" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Hello !
I want to create a MVC 5 application using Visual Studio 2013 .
I have the following problem :
I created a controller to display data from a table and then created a view using Add View for the
return View(); method . The view is created , but when I try to go to the view from the controller , the "Unable to find a matching view" error is shown . How can I link the view to the controller ?
Sorry if this question was asked before .
|
|
|
|
|
Problem solved , apparently my view wasn't named properly .
|
|
|
|
|
Hi,
Your View Name is same as controller Method Name and also in correct folder as per Controller Name ?
Thanks
Raviranjan
|
|
|
|
|
I created the view , but renamed it , so the controller didn't recognize it . Thanks !
|
|
|
|
|
Hi,
I want to develop a Survey module using MVC4, for that i have a set of questions for each questions i have 4 options & these options should be radio button in the application and all questions will be having same options
EX, Agree,Disagree, Strongly agree,Strongly Disagree.
How can i achieve this using MVC4. I tried several links but no link is helping out
EX: Tried This[^]
NOTE: I am a beginner in MVC
|
|
|
|
|
Hi Vishal,
So you mean that, let say Quetion1, Question2, Question3,... and for each question you will have Option1, Option2, Option3, Option4 and for each question you will have - Agree,Disagree, Strongly agree, Strongly Disagree,
Like
Question1
Option1, Option2, Option3, Option4
Disagree, Agree, Strongly Agree, Strongly Disagree
Question2
Option1, Option2, Option3, Option4
Disagree, Agree, Strongly Agree, Strongly Disagree
.....................
Right?
Thanks
Raviranjan
|
|
|
|
|
Hi Raviranjan,
Thanks for the reply,
Ya exactly i wanted and achieved it,
Thanks
Vishwa
|
|
|
|
|
Hi Vishwa,
Below i am giving idea how you can do it.
In View on top
@model IEnumerable<question>--> This is basically the list of Question that you have to return from controller method
Then HTML Code for Displaying the Question and their option
@foreach (Question question in Model)
{
@Html.DisplayFor(modelItem => question.QuestionText)
foreach (Option option in question.Options)
{
option.OptionText : @Html.RadioButtonFor(opt=>option.OptionID,option.OptionValue)
}
<HTML for like> Agree, DisAgree,...
}
The Class of Question and Option will be like below
public class Option{
public int OptionID{get;set;}
public string OptionText{get;set;}
public string OptionValue{get;set;}
}
public class Question{
public string QuestionText{get;set;}
public List Options{get;set;}//This will contain all 4 option
}
Class name and properties you can put whatever you want, i have just wrote sample.
Let me know if you have any doubt.
Thanks
Raviranjan
|
|
|
|
|
Thank you so much for the help.
I was trying something and achieved it.
|
|
|
|
|
Hi everyone.
I'm looking for the solution of Add New Row on ADO.NET
Currently, I'm using ADODB.Recordset to insert / update the Value.
Ussually, my code is
Dim rstDB as ADODB.Recordset = new ADODB.Recordset
rstDB.Open("Select * From Test Where 1=2" , MyConnection, 2,3)
With rstDB
.AddNew()
.Update()
End With
rstDB.Close
So, if I want to insert into another Table, what i need to is change my Query and reuse "rstDB" again.
My Question is,
Is there any way to do that on ADO.NET with SQLDataAdapter ?
I appreciate if you can give me sample code.
Thank in advance.
Thomas from Vietnam
|
|
|
|
|
Hello,
I am a new to MVC and I am tasked to develop a role based security portion of our current MVC razor application having the user authentication done via AD then once authenticated determining authorization via our entity framework model. Now, once the user navigates through the application MVC Views, menu and button controls on each View are hidden or shown based on their permissions.
Currently, the application controllers return a single MVC model object with all of the current required values contained in it (i.e. m.EmployeeName, m.CustomerName, etc.) but as you know no user or role information.
At this point I really don't know the best way to implement this. What do I add to the entity framework model. Next, from the controller GET only a single model object is returned in the view(model). How would I return the user's name and roles information along with the main model object? Also, any ideas on how the user/role admin view should work would be great. Anyone, please help!
modified 14-Jun-14 15:12pm.
|
|
|
|
|
I do think I found a very good solution for implementing the MVC Role manager functionally managing active directory roles via ASP.NET Identity System and using Entity Framework for maintaining state. I am going to refer to this article:
http://typecastexception.com/post/2014/02/19/ASPNET-MVC-5-Identity-Implementing-Group-Based-Permissions-Management-Part-I.aspx
for my solution. Because I am new to MVC, if anyone sees a problem with this functionally please let me know and correct me as necessary.
Thanks to everyone!
Steve Holdorf
|
|
|
|
|
Hi all,
I am using bootstrap with asp.net c# website, every thing is fine. but postback event of radio button and checkbox is not working.
can any one help me , how to do this. or how we can remove css/jquery for the radio button/ checkbox.
code used : <asp:radiobutton id="rdbtn1" runat="server" text="Check me" autopostback="true" oncheckedchanged="radio_checked">
<asp:checkbox id="chk1" runat="server" text="radio button" autopostback="true" oncheckedchanged="chk_checked">
please help.
thanks
|
|
|
|
|
is your page load event called ? please check.
if yes then please check have you set any default check for checkbox/radiobutton in page_load ? because checkbox/radiobutton server side event not fired when checked property is set to true
Or you can Get it inside an update panel, with property "ChildrenAsTriggers" on true
|
|
|
|
|
Hello thanks for you response,
i checked your suggestion but this is not working.
|
|
|
|
|