May be this error is due to course.HttpContext. It has null value. When i set it as "course.HttpContext = httpcontextformail.HttpContextReference;" it shows a warning
"umbraco.cms.businesslogic.web.document.HttpContext is obsolute. Do not use this . Get httpContext via regular ASP.Net methods instead". When i debug this code , i got HttpContext on httpcontextformail.HttpContextReference. But after executing "course.HttpContext = httpcontextformail.HttpContextReference;",
Object reference not set to an instance of an object
Hi,
Due to performance issue , i have added the publishing code in thread
try
{
HttpontextforMailSending gethttpcontextforpublish2 = new HttpontextforMailSending()
{
HttpContextReference = HttpContext.Current,
courseDocument = shortCourseDocument,
createdUser = new User(0)
};
Thread t2 = new Thread(PublishDocument);
t2.Start(gethttpcontextforpublish2);
}
catch
{
}
private void PublishDocument(object input)
{
HttpontextforMailSending httpcontextformail = (HttpontextforMailSending)input;
Document course = httpcontextformail.courseDocument;
User createduser = httpcontextformail.createdUser;
if (course != null && createduser != null)
{
course.Publish(createduser);
umbraco.library.UpdateDocumentCache(course.Id);
}
}
public class HttpontextforMailSending
{
public HttpContext HttpContextReference { get; set; }
public Document courseDocument { get; set; }
public User createdUser { get; set; }
}
but i got "Object reference not set to an instance of an object" error on "course.Publish(createduser);"
Please anyone help me to solving this.
Thanks
Jeeshna
Hi,
May be this error is due to course.HttpContext. It has null value. When i set it as "course.HttpContext = httpcontextformail.HttpContextReference;" it shows a warning
"umbraco.cms.businesslogic.web.document.HttpContext is obsolute. Do not use this . Get httpContext via regular ASP.Net methods instead". When i debug this code , i got HttpContext on httpcontextformail.HttpContextReference. But after executing "course.HttpContext = httpcontextformail.HttpContextReference;",
"course.HttpContext" still have null value.
Please help me
At last done. The idea is call webservice from thread.
is working on a reply...