I'm trying to parse RSS feeds from a url using feedparser in python.
>>> import feedparser
>>> d = feedparser.parse('http://www.shop.inonit.in/RSSFeedDetails.aspx?PID=801')
>>> d
{'feed': {'summary': u'<span><h1>Server Error in \'/mobile\' Application.<hr color="silver" size="1" width="100%" /></h1>\n\n
<h2> <i>Attempted to divide by zero.</i> </h2></span>\n\n <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">\n\n <b> Description: </b>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.\n\n <br /><br />\n\n <b> Exception Details: </b>System.DivideByZeroException: Attempted to divide by zero.<br /><br />\n\n
<b>Source Error:</b> <br /><br />\n\n <table bgcolor="#ffffcc" width="100%">\n <tr>\n <td>\n <code>\n\nAn unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code>\n\n </td>\n </tr>\n </table>\n\n <br />\n\n <b>Stack Trace:</b> <br /><br />\n\n <table bgcolor="#ffffcc" width="100%">\n <tr>\n <td>\n <code><pre>\n\n[DivideByZeroException: Attempted to divide by zero.]\n System.Decimal.FCallDivide(Decimal& d1, Decimal& d2) +0\n System.Decimal.Divide(Decimal d1, Decimal d2) +17\n Martjack.CMS.PageControlsModelComp.GetPluginDataEnt(PageControlEnt objPageControlEnt, MerchantENT MerchantEnt, PageControlModel& objPageControlModel, ProductEnt_RE ProductEnt, String MobileVersion) +2324\n
Martjack.CMS.PageControlsModelComp.GetPageControlOutputData(PageModel pagemodel, PageControlEnt objPageControlEnt, MerchantENT MerchantEnt, String seocid, String combiType, String MobileVersion, ProductEnt_RE ProductEnt, String siteurl) +694\n Martjack.CMS.PageControlsModelComp.GetPageControlModels(PageModel Pagemodel, MerchantENT MerchantEnt, String seocid, String combiType, String MobileVersion, DNDPageControlViewCollection objDNDPageControlViewCollection, Boolean isdndrequest, Int64 pgcontrolid, String siteurl) +919\n Martjack.CMS.PageModelComp.GetPageModel(MerchantENT MerchantEnt, Int32 predefinedPageId, Boolean isPredefined, ChannelType channel, String seocid, String Bid, String combiType, String MobileVersion, Boolean isDndRequest,
DNDPageControlViewCollection ObjDNDPageControlViewCollection, Boolean ControlsInfo, Int64 pgcontrolid) +1717\n MartJack.Facade.CMSFacade.GetPageModel(MerchantENT MerchantEnt, Int32 PageId, Boolean isPredefined, ChannelType channel, String seocid, String bid, String combitype, String mobileversion, Boolean isDndRequest, DNDPageControlViewCollection ObjDNDPageControlViewCollection, Boolean ControlsInfo, Int64 pgcontrolid) +119\n MobileECommerce.MobileECommerce.ProductsController.GetPageModelByRequest(String seoid, String bid) +227\n MobileECommerce.MobileECommerce.ProductsController.Index(String id, String seobrand, String category, String categoryparent) +54\n lambda_method(Closure , ControllerBase , Object[] ) +272\n
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17\n System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +212\n System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +239\n System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +56\n System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +282\n System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +20\n System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +201\n System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +351\n System.Web.Mvc.Controller.ExecuteCore() +99\n System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +94\n System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10\n
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +43\n System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21\n System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12\n System.Web.Mvc.Async.WrappedAsyncResult`1.End() +53\n System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +28\n System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +15\n System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +34\n System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7\n System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +23\n System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +68\n
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9\n System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +714\n System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +240\n</pre></code>\n\n </td>\n </tr>\n </table>\n\n <br />\n\n
<hr color="silver" size="1" width="100%" />\n\n <b>Version Information:</b>\xa0Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272\n\n </font>'}, 'status': 302, 'version': u'', 'encoding': u'utf-8', 'bozo': 1, 'headers': {'content-length': '11348', 'x-powered-by': 'ASP.NET', 'set-cookie': 'SERVERID=HAS14; path=/', 'originserver': 'HAS14', 'server': 'Microsoft-IIS/7.5', 'connection': 'close', 'cache-control': 'private', 'date': 'Tue, 16 Apr 2013 08:03:59 GMT', 'content-type': 'text/html; charset=utf-8', 'x-aspnet-version': '4.0.30319'}, 'href':
u'http://www.shop.inonit.in/mobile/Products//NA/NA/0', 'namespaces': {}, 'entries': [], 'bozo_exception': SAXParseException('not well-formed (invalid token)',)}
I get nothing in the output, while if you go to the link (http://www.shop.inonit.in/RSSFeedDetails.aspx?PID=801) it shows a whole lot of stuff!
Maybe it is redirecting me to some other page that does't exist (as I tried crawling individual pages of this website using scrapy, but couldn't, since I was redirected to some non-existant url).
Any help on this would be great. Thanks!
Are you using proxy?
If you are, do it this way -
import urllib2, feedparser
proxy = urllib2.ProxyHandler({"http":"proxy:port"})
d = feedparser.parse('http://www.shop.inonit.in/RSSFeedDetails.aspx?PID=801', handlers = [proxy])
Related
Using Umbraco version 7.4.3 assembly: 1.0.5948.18141
After creating a form using umbraco 7.4.3 the form works as expected, except when we access the form via a protected page. The form displays, and allows user interaction, however we are unable to submit form from protected page.
There was a question posed on the umbraco forum that suggested a fix was found, but no information for that fix was posted here -> https://our.umbraco.org/forum/umbraco-forms/78933-umbraco-forms-and-protected-pages,
I have also posted a question regarding this issue in the umbraco forums - no answer todate.
YSOD when submitting form from a protected page. Stack trace below:
[NullReferenceException: Object reference not set to an instance of an
object.]
Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String
cacheKey, Func1 getCacheItem, Nullable1 timeout, Boolean isSliding,
CacheItemPriority priority, CacheItemRemovedCallback removedCallback,
CacheDependency dependency) +825
Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String
cacheKey, Func1 getCacheItem, Nullable1 timeout, Boolean isSliding,
CacheItemPriority priority, CacheItemRemovedCallback removedCallback,
String[] dependentFiles) +200
Umbraco.Core.Cache.DeepCloneRuntimeCacheProvider.GetCacheItem(String
cacheKey, Func1 getCacheItem, Nullable1 timeout, Boolean isSliding,
CacheItemPriority priority, CacheItemRemovedCallback removedCallback,
String[] dependentFiles) +183
Umbraco.Forms.Core.Cache.CacheProviderExtensions.GetCacheItem(IRuntimeCacheProvider
provider, String cacheKey, Func1 getCacheItem, Nullable1 timeout,
Boolean isSliding, CacheItemPriority priority,
CacheItemRemovedCallback removedCallback, String[] dependentFiles)
+541 Umbraco.Forms.Data.StringHelper.ParseMemberPlaceholders(String value, Object memberKey) +1990
Umbraco.Forms.Data.StringHelper.ParsePlaceHolders(HttpContext context,
Record record, String value) +584
Umbraco.Forms.Data.StringHelper.ParsePlaceHolders(Record record,
String value) +75
Umbraco.Forms.Core.Services.WorkflowService.ExecuteWorkflows(List1
workflows, RecordEventArgs e) +1158
Umbraco.Forms.Core.Services.WorkflowService.ExecuteWorkflows(Record
record, Form form, FormState state, Boolean editMode) +468
Umbraco.Forms.Web.Services.RecordService.Submit(Record record, Form
form) +704
Umbraco.Forms.Web.Controllers.UmbracoFormsController.SubmitForm(Form
form, FormViewModel model, Dictionary2 state, ControllerContext
context) +3103
Umbraco.Forms.Web.Controllers.UmbracoFormsController.GoForward(Form
form, FormViewModel model, Dictionary2 state) +339
Umbraco.Forms.Web.Controllers.UmbracoFormsController.HandleForm(FormViewModel
model, Boolean captchaIsValid) +1283 lambda_method(Closure ,
ControllerBase , Object[] ) +167
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
controllerContext, IDictionary2 parameters) +217
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
controllerContext, ActionDescriptor actionDescriptor, IDictionary2
parameters) +39
System.Web.Mvc.Async.AsyncControllerActionInvoker.b__39(IAsyncResult
asyncResult, ActionInvocation innerInvokeState) +12
System.Web.Mvc.Async.WrappedAsyncResult2.CallEndDelegate(IAsyncResult
asyncResult) +139
System.Web.Mvc.Async.AsyncInvocationWithFilters.b3d() +112
System.Web.Mvc.Async.<>cDisplayClass46.b3f() +452
System.Web.Mvc.Async.<>cDisplayClass46.b3f() +452
System.Web.Mvc.Async.<>cDisplayClass46.b3f() +452
System.Web.Mvc.Async.<>cDisplayClass46.b3f() +452
System.Web.Mvc.Async.<>cDisplayClass46.b3f() +452
System.Web.Mvc.Async.<>cDisplayClass33.b32(IAsyncResult asyncResult)
+15 System.Web.Mvc.Async.<>cDisplayClass2b.b1c() +37 System.Web.Mvc.Async.<>cDisplayClass21.b1e(IAsyncResult asyncResult)
+241 System.Web.Mvc.Controller.b1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult
asyncResult) +111
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult
asyncResult) +19 System.Web.Mvc.MvcHandler.b__5(IAsyncResult
asyncResult, ProcessRequestState innerState) +51
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult
asyncResult) +111
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+606 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
There is a reply in the thread you've mentioned: https://our.umbraco.org/forum/umbraco-forms/78933-umbraco-forms-and-protected-pages#comment-256103. Hope it'll help you :)
I am getting this error message.
Server Error in '/' Application.
Operation is not valid due to the current state of the object.
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.InvalidOperationException: Operation is not valid due to the current state of the object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Operation is not valid due to the current state of the object.]
System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded() +2420322
System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding) +58
System.Web.HttpRequest.FillInFormCollection() +159
[HttpException (0x80004005): The URL-encoded form data is not valid.]
System.Web.HttpRequest.FillInFormCollection() +217
System.Web.HttpRequest.get_Form() +104
Microsoft.Web.Infrastructure.DynamicValidationHelper.<>c__DisplayClass8.<MakeCollectionsLazy>b__2() +12
Microsoft.Web.Infrastructure.DynamicValidationHelper.<>c__DisplayClass12.<ReplaceCollection>b__e() +61
Microsoft.Web.Infrastructure.DynamicValidationHelper.<>c__DisplayClass12.<ReplaceCollection>b__11() +17
Microsoft.Web.Infrastructure.DynamicValidationHelper.DeferredCountArrayList.get_Count() +17
System.Collections.Specialized.NameObjectCollectionBase.get_Count() +15
System.Web.HttpRequest.ValidateNameValueCollection(NameValueCollection nvc, RequestValidationSource requestCollection) +23
System.Web.HttpRequest.get_Form() +150
System.Web.HttpRequestWrapper.get_Form() +11
System.Web.Mvc.HttpRequestExtensions.GetHttpMethodOverride(HttpRequestBase request) +126
System.Web.Mvc.AcceptVerbsAttribute.IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo) +41
System.Web.Mvc.HttpGetAttribute.IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo) +40
System.Web.Mvc.<>c__DisplayClass11.<RunSelectionFilters>b__d(ActionMethodSelectorAttribute attr) +24
System.Linq.Enumerable.All(IEnumerable`1 source, Func`2 predicate) +145
System.Web.Mvc.ActionMethodSelector.RunSelectionFilters(ControllerContext controllerContext, List`1 methodInfos) +319
System.Web.Mvc.ActionMethodSelector.FindActionMethod(ControllerContext controllerContext, String actionName) +59
System.Web.Mvc.ReflectedControllerDescriptor.FindAction(ControllerContext controllerContext, String actionName) +62
System.Web.Mvc.ControllerActionInvoker.FindAction(ControllerContext controllerContext, ControllerDescriptor controllerDescriptor, String actionName) +16
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +105
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8969201
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
I have tried doing the suggested fix off
<appSettings>
<add key="aspnet:MaxHttpCollectionKeys" value="1001" />
</appSettings>
I tried putting it at some crazy number
<add key="aspnet:MaxHttpCollectionKeys" value="10000000000" />
yet it still gives me the same error (I have alot of fields but not that many). I am using asp.net mvc 3 (razor). I am using .net 4.0.
I am sending the whole form by jquery ajax(seralizeArrary) so I don't know if that has something to do with it or not.
Use a more reasonable value such as 32000, that works fine for me.
Is there a way also to limit it to which forms this is allowed on and not global as it seems to be right now?
No, I don't think that is is possible to handle this setting per form. This is because the values are parsed very eary before the routing takes place, but only after routing it would be known what "form" this belongs to.
Following are the limits:
MaxHttpCollectionKeys is an int, so it could have a max value of an integer (int.MaxValue: 2,147,483,647)
Minimum value is 1
Default value is 1000
Check on MSDN
I had wrote a web site using asp.net mvc3 and used Membership class for user management.
everything work fine on my localhost server in VS2010 but when I deploy that to server I got some times following error:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 7/23/2011 3:30:31 PM
Event time (UTC): 7/23/2011 10:30:31 PM
Event ID: 5afe87171ad743d39bf87e29f8501615
Event sequence: 7785
Event occurrence: 49
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/3/ROOT-3-129559136991646761
Trust level: Full
Application Virtual Path: /
Application Path: C:\inetpub\wwwroot\bandarMVC\
Machine name: BANDARPAYANE
Process information:
Process ID: 2612
Process name: w3wp.exe
Account name: IIS APPPOOL\MVC
Exception information:
Exception type: IndexOutOfRangeException
Exception message: Index was outside the bounds of the array.
at System.Data.SqlClient.SqlDataReader.ReadColumn(Int32 i, Boolean setTimeout)
at System.Data.SqlClient.SqlDataReader.GetInt32(Int32 i)
at System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate)
at System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat)
at System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password)
at BandarMVC.Controllers.AccountController.LogOn(LogOnModel model, String returnUrl) in C:\Users\Javad\Documents\Visual Studio 2010\Projects\BandarMVC\BandarMVC\Controllers\AccountController.cs:line 40
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
at System.Web.Mvc.Controller.ExecuteCore()
at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__5()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d()
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Request information:
Request URL: http://10.1.1.90/Account/LogOn?ReturnUrl=/
Request path: /Account/LogOn
User host address: 10.1.1.90
User:
Is authenticated: False
Authentication Type:
Thread account name: IIS APPPOOL\MVC
Thread information:
Thread ID: 26
Thread account name: IIS APPPOOL\MVC
Is impersonating: False
Stack trace: at System.Data.SqlClient.SqlDataReader.ReadColumn(Int32 i, Boolean setTimeout)
at System.Data.SqlClient.SqlDataReader.GetInt32(Int32 i)
at System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate)
at System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat)
at System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password)
at BandarMVC.Controllers.AccountController.LogOn(LogOnModel model, String returnUrl) in C:\Users\Javad\Documents\Visual Studio 2010\Projects\BandarMVC\BandarMVC\Controllers\AccountController.cs:line 40
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
at System.Web.Mvc.Controller.ExecuteCore()
at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__5()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d()
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Custom event details:
does anyone one knows reason of this error and solution of that?
the following code throws this exception:
[HttpPost]
public ActionResult LogOn(LogOnModel model, string returnUrl)
{
BuildMenu();
if (ModelState.IsValid)
{
-------> if (Membership.ValidateUser(model.UserName, model.Password)) <----------------
{
FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/")
&& !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction("Index", "Home");
}
}
else
{
ModelState.AddModelError("", "نام کاربر و یا شناسه عبور صحیح نمی باشد");
}
}
// If we got this far, something failed, redisplay form
return View(model);
}
It looks like the database you are connecting to when you deployed your application was created with some older version of the .NET Framework aspnet_regsql.exe utility. Try creating and configuring the membership database with the same version of aspnet_regsql you used locally. Or maybe locally you simply used SQL Express and the ~/App_Data folder.
My custom model binder which has been working perfectly has starting giving me errors
details below
An item with the same key has already been added. 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: An item with the same key
has already been added.
Source Error:
Line 31: { Line 32: string key = bindingContext.ModelName; Line 33:
var doc = base.BindModel(controllerContext, bindingContext) as
Document; Line 34: Line 35: // DoBasicValidation(bindingContext, doc);
Source File: C:\Users\Bich Vu\Documents\Visual Studio
2008\Projects\PitchPortal\PitchPortal.Web\Binders\DocumentModelBinder.cs
Line: 33
Stack Trace:
[ArgumentException: An item with the same key has already been added.]
System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
+51 System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) +7462172
System.Linq.Enumerable.ToDictionary(IEnumerable1 source, Func2
keySelector, Func2 elementSelector, IEqualityComparer1 comparer) +270
System.Linq.Enumerable.ToDictionary(IEnumerable1 source, Func2
keySelector, IEqualityComparer1 comparer) +102
System.Web.Mvc.ModelBindingContext.get_PropertyMetadata() +157
System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext
controllerContext, ModelBindingContext bindingContext,
PropertyDescriptor propertyDescriptor) +158
System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext
controllerContext, ModelBindingContext bindingContext) +90
System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext
controllerContext, ModelBindingContext bindingContext, Object model)
+50 System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext
controllerContext, ModelBindingContext bindingContext) +1048
System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext
controllerContext, ModelBindingContext bindingContext) +280
PitchPortal.Web.Binders.documentModelBinder.BindModel(ControllerContext
controllerContext, ModelBindingContext bindingContext) in
C:\Users\Bich Vu\Documents\Visual Studio
2008\Projects\PitchPortal\PitchPortal.Web\Binders\DocumentModelBinder.cs:33
System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext
controllerContext, ParameterDescriptor parameterDescriptor) +257
System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext
controllerContext, ActionDescriptor actionDescriptor) +109
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext
controllerContext, String actionName) +314
System.Web.Mvc.Controller.ExecuteCore() +105
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
+39 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext
requestContext) +7 System.Web.Mvc.<>c_DisplayClass8.b_4() +34
System.Web.Mvc.Async.<>c_DisplayClass1.b_0() +21
System.Web.Mvc.Async.<>c__DisplayClass81.b__7(IAsyncResult
_) +12 System.Web.Mvc.Async.WrappedAsyncResult1.End() +59 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
+44 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult
result) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+8677678 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
any ideas guys? Thanks
See here, you probably got the same issue.
And please don't ask same question several times. You can just edit it.
I need to render a pdf while clicking a button.
i am using the following js code:
function RenderPDf() {
//for
window.open("/Resources/RenderPDF", "", 'toolbar=no,titlebar=no, directories=no, location=no,status=yes, menubar=no, resizable=yes, scrollbars=yes,width=1010, height=680,left=0,top=0');
return false;
}
But i am getting the following error sometimes:
Message :Server cannot set content type after HTTP headers have been sent.
Source :System.Web
Stack Trace : at System.Web.HttpResponse.set_ContentType(String value)
at System.Web.UI.Page.SetIntrinsics(HttpContext context, Boolean allowAsync)
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.views_file_viewtaxreturn_aspx.ProcessRequest(HttpContext context)
at System.Web.Mvc.ViewPage.RenderView(ViewContext viewContext)
at System.Web.Mvc.WebFormView.RenderViewPage(ViewContext context, ViewPage page)
at System.Web.Mvc.WebFormView.Render(ViewContext viewContext, TextWriter writer)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass11.<InvokeActionResultWithFilters>b__e()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass11.<>c__DisplayClass13.<InvokeActionResultWithFilters>b__10()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
at System.Web.Mvc.Controller.ExecuteCore()
at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext)
at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext)
at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext)
at System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
TargetSite :Void set_ContentType(System.String)
Please suggest with this exception.
Solved this error by returning EmptyResult in the controller
return new EmptyResult();
As a suggestion, when I've had this problem it's been because I've had whitespace / new lines / html code before I started my code blocks. Check you're not sending something to the client before you call your function.
Anything, and I mean anything sent to the client before the headers you intend to set can cause this error. Somewhere, under some conditions, your app is sending something to the client before your desired headers.