Click here to Skip to main content
15,845,469 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: trying to call a WebApi method along with new Page when button clicked using jQuery Pin
Richard Deeming1-Aug-17 1:50
mveRichard Deeming1-Aug-17 1:50 
GeneralRe: trying to call a WebApi method along with new Page when button clicked using jQuery Pin
indian1431-Aug-17 8:01
indian1431-Aug-17 8:01 
GeneralRe: trying to call a WebApi method along with new Page when button clicked using jQuery Pin
Richard Deeming1-Aug-17 8:24
mveRichard Deeming1-Aug-17 8:24 
GeneralRe: trying to call a WebApi method along with new Page when button clicked using jQuery Pin
indian1431-Aug-17 14:23
indian1431-Aug-17 14:23 
QuestionI would like to develope new project from scratch. I would like to use ASP.NET MVC 5.0, EntityFramework and SQL Server. Pin
Lad Kunal30-Jul-17 21:14
Lad Kunal30-Jul-17 21:14 
AnswerRe: I would like to develope new project from scratch. I would like to use ASP.NET MVC 5.0, EntityFramework and SQL Server. Pin
Richard MacCutchan30-Jul-17 21:42
mveRichard MacCutchan30-Jul-17 21:42 
AnswerRe: I would like to develope new project from scratch. I would like to use ASP.NET MVC 5.0, EntityFramework and SQL Server. Pin
indian1432-Aug-17 7:57
indian1432-Aug-17 7:57 
QuestionError message: The operation cannot be completed because the DbContext has been disposed Pin
indian14327-Jul-17 12:39
indian14327-Jul-17 12:39 
Hi,

I am getting the error when trying to load data from the WebApi call,
{"Message":"An error has occurred.","ExceptionMessage":"The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; charset=utf-8'.",
"ExceptionType":"System.InvalidOperationException","StackTrace":null,"InnerException":{"Message":"An error has occurred.","ExceptionMessage":
"The operation cannot be completed because the DbContext has been disposed.","ExceptionType":"System.InvalidOperationException","StackTrace":"   
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()\r\n   at System.Data.Entity.Internal.Linq.InternalQuery`1.GetEnumerator()\r\n   at 
System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.IEnumerable.GetEnumerator()\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList
(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n   at 
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)\r\n   at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)\r\n   at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\r\n   at System.Net.Http.Formatting.JsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\r\n   at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content)\r\n   at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.WebHost.HttpControllerHandler.<WriteBufferedResponseContentAsync>d__1b.MoveNext()"}}
My code looks like:
        public List<UserList> Get()
        {
            dynamic model = null;
            using (AppDevSecEntities ctx = new AppDevSecEntities())
            {
                var temp = ctx.UserLists.OrderByDescending(x => x.LastName);
                if (temp != null)
                    model = temp.ToList<UserList>();
            }
            return model;
        }

Any help would be very helpful thanks in advance.

Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."
AnswerRe: Error message: The operation cannot be completed because the DbContext has been disposed Pin
Richard Deeming28-Jul-17 2:31
mveRichard Deeming28-Jul-17 2:31 
AnswerRe: Error message: The operation cannot be completed because the DbContext has been disposed Pin
Nathan Minier28-Jul-17 2:36
professionalNathan Minier28-Jul-17 2:36 
QuestionUnable to use RequiredValidator control to validate RadioButtonList in Repeater? Pin
samflex26-Jul-17 15:25
samflex26-Jul-17 15:25 
AnswerRe: Unable to use RequiredValidator control to validate RadioButtonList in Repeater? Pin
F-ES Sitecore26-Jul-17 23:45
professionalF-ES Sitecore26-Jul-17 23:45 
GeneralRe: Unable to use RequiredValidator control to validate RadioButtonList in Repeater? (SOLVE) Pin
samflex27-Jul-17 4:05
samflex27-Jul-17 4:05 
QuestionFew questions about web api versioning in core Pin
Mou_kol26-Jul-17 2:38
Mou_kol26-Jul-17 2:38 
QuestionEnable/Disable div based on RadiobuttonList Pin
samflex25-Jul-17 6:41
samflex25-Jul-17 6:41 
AnswerRe: Enable/Disable div based on RadiobuttonList Pin
F-ES Sitecore25-Jul-17 7:30
professionalF-ES Sitecore25-Jul-17 7:30 
AnswerRe: Enable/Disable div based on RadiobuttonList Pin
Richard Deeming25-Jul-17 7:50
mveRichard Deeming25-Jul-17 7:50 
GeneralRe: Enable/Disable div based on RadiobuttonList (SOLVED) Pin
samflex25-Jul-17 10:32
samflex25-Jul-17 10:32 
QuestionVisual Studio & Asp.Net in Web Forms Bad Design view Pin
zequion23-Jul-17 3:23
professionalzequion23-Jul-17 3:23 
QuestionTable resizing in MVC bootstrap Pin
Member 1075459521-Jul-17 8:31
Member 1075459521-Jul-17 8:31 
AnswerRe: Table resizing in MVC Pin
Member 1075459527-Jul-17 11:44
Member 1075459527-Jul-17 11:44 
QuestionResponse.Cache, Code Location Pin
jkirkerx17-Jul-17 10:24
professionaljkirkerx17-Jul-17 10:24 
AnswerRe: Response.Cache, Code Location Pin
Richard Deeming17-Jul-17 11:09
mveRichard Deeming17-Jul-17 11:09 
GeneralRe: Response.Cache, Code Location Pin
jkirkerx18-Jul-17 8:38
professionaljkirkerx18-Jul-17 8:38 
QuestionUsing Visual Studio to debug iHTTPHandler routines Pin
Member 839420716-Jul-17 22:26
Member 839420716-Jul-17 22:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.