Error in login to asp.net web site using membership class - asp.net

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.

Related

Microsoft Dynamics CRM 365 (On-premise) Opening Web Portal - Error

We have installed MS Dynamics CRM 365 as below structure :
2 Frontend (subnet 1)
2 Backend (Subnet 2)
1 Deployment Server (Subnet 2)
2 SQL servers clsuter (subnet 3)
After creating organization and navigate to open the portal http://localhost/test
below error shown in browser :
An error has occurred.
Try this action again. If the problem continues, check the Microsoft Dynamics 365 Community for solutions or contact your organization's Microsoft Dynamics 365 Administrator. Finally, you can contact Microsoft Support.
Error in event viewer :
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 12/21/2020 4:17:46 PM
Event time (UTC): 12/21/2020 1:17:46 PM
Event ID: 721f2fbf17df4bc2929208fa2b1f7c77
Event sequence: 11
Event occurrence: 5
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/1/ROOT-1-132530280420389099
Trust level: Full
Application Virtual Path: /
Application Path: C:\Program Files\Dynamics 365\CRMWeb\
Machine name: zzzzzzz
Process information:
Process ID: 7400
Process name: w3wp.exe
Account name: domain\eeeeee
Exception information:
Exception type: CrmException
Exception message: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Crm.ServerLocatorService.GetSiteSetting[T](String settingName, Boolean defaultOnError)
at Microsoft.Crm.Caching.OrganizationSettings.LazyLoadPrivGroup()
at Microsoft.Crm.Caching.OrganizationSettings.get_PrivilegeUserGroupSid()
at Microsoft.Crm.BusinessEntities.SecurityLibrary.CheckPrivilegeGroupForOrganization(WindowsIdentity identity, IOrganizationContext context)
at Microsoft.Crm.BusinessEntities.SecurityLibrary.TryCheckPrivilegeGroupForOrganization(ExecutionContext context, Boolean checkImpersonatePrivilege)
at Microsoft.Crm.Extensibility.ExternalMessageDispatcher.VerifyCallerOrigin(ExecutionContext context)
at Microsoft.Crm.Extensibility.ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, Guid callerRegardingObjectId, Int32 invocationSource, Version endpointVersion, OrganizationRequest request, OrganizationInternalRequest organizationInternalRequest)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.DispatchRequest(OrganizationRequest request, OrganizationInternalRequest organizationInternalRequest, SdkResponseDescription responseDescription, SdkPerformanceCounterContext sdkPerformanceCounterContext)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.ExecuteRequestRequestWithInstrumentation(OrganizationRequest request, OrganizationInternalRequest organizationInternalRequest)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.<>c__DisplayClass17_0.<ExecuteRequest>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Guid targetCallerRegardingObjectId, UserType targetUserType, OrganizationContext context, Boolean returnResponse, Boolean checkAdminMode)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.ExecuteRequestInternal(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext): Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #87E0490D
at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
at Microsoft.Crm.Application.Platform.ServiceCommands.RetrieveMultipleCommand.Execute()
at Microsoft.Crm.Application.Platform.DataSource.RetrieveMultiple(QueryExpression query, Boolean retrieveLatest, Boolean useSystemUserContext, IOrganizationContext context)
at Microsoft.Crm.Application.Caching.CustomResourceLoader.GetCustomResources(IOrganizationContext context, Int32 cacheKey)
at Microsoft.Crm.Application.Caching.CustomResourceLoader.LoadCacheData(Int32 key, IOrganizationContext context)
at Microsoft.Crm.Caching.CrmMultiOrgCacheBase`2.CreateEntry(TKey key, IOrganizationContext context)
at Microsoft.Crm.Caching.CrmMultiOrgCacheBase`2.<>c__DisplayClass19_0.<LookupEntry>b__2()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at Microsoft.Crm.Caching.CrmMultiOrgCacheBase`2.LookupEntry(TKey key, IOrganizationContext context)
at Microsoft.Crm.Application.ResourceManager.CustomResourceManager.TryGetCustomString(String name, CultureInfo culture, IOrganizationContext context)
at Microsoft.Crm.Application.ResourceManager.CustomResourceManager.TryGetCultureString(String name, CultureInfo culture, IOrganizationContext context)
at Microsoft.Crm.Application.ResourceManager.BasicResourceManager.GetCultureString(String name, CultureInfo culture, IOrganizationContext context)
at Microsoft.Crm.Controls.Header..ctor(Boolean isControlHeader)
at Microsoft.Crm.Controls.BasicHeader..ctor()
at Microsoft.Crm.Application.Controls.AppHeader..ctor()
at ASP.test5_default_aspx.__BuildControlcrmHeader()
at ASP.test5_default_aspx.__BuildControlTree(test5_default_aspx __ctrl)
at ASP.test5_default_aspx.FrameworkInitialize()
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Request information:
Request URL: http://zzzzzzz/Test5/default.aspx
Request path: /Test5/default.aspx
User host address: 172.16.xx.xxx
User: domain\eeeeee
Is authenticated: True
Authentication Type: Negotiate
Thread account name: domain\eeeeee
Thread information:
Thread ID: 165
Thread account name: domain\eeeeee
Is impersonating: True
Stack trace: at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
at Microsoft.Crm.Application.Platform.ServiceCommands.RetrieveMultipleCommand.Execute()
at Microsoft.Crm.Application.Platform.DataSource.RetrieveMultiple(QueryExpression query, Boolean retrieveLatest, Boolean useSystemUserContext, IOrganizationContext context)
at Microsoft.Crm.Application.Caching.CustomResourceLoader.GetCustomResources(IOrganizationContext context, Int32 cacheKey)
at Microsoft.Crm.Application.Caching.CustomResourceLoader.LoadCacheData(Int32 key, IOrganizationContext context)
at Microsoft.Crm.Caching.CrmMultiOrgCacheBase`2.CreateEntry(TKey key, IOrganizationContext context)
at Microsoft.Crm.Caching.CrmMultiOrgCacheBase`2.<>c__DisplayClass19_0.<LookupEntry>b__2()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at Microsoft.Crm.Caching.CrmMultiOrgCacheBase`2.LookupEntry(TKey key, IOrganizationContext context)
at Microsoft.Crm.Application.ResourceManager.CustomResourceManager.TryGetCustomString(String name, CultureInfo culture, IOrganizationContext context)
at Microsoft.Crm.Application.ResourceManager.CustomResourceManager.TryGetCultureString(String name, CultureInfo culture, IOrganizationContext context)
at Microsoft.Crm.Application.ResourceManager.BasicResourceManager.GetCultureString(String name, CultureInfo culture, IOrganizationContext context)
at Microsoft.Crm.Controls.Header..ctor(Boolean isControlHeader)
at Microsoft.Crm.Controls.BasicHeader..ctor()
at Microsoft.Crm.Application.Controls.AppHeader..ctor()
at ASP.test5_default_aspx.__BuildControlcrmHeader()
at ASP.test5_default_aspx.__BuildControlTree(test5_default_aspx __ctrl)
at ASP.test5_default_aspx.FrameworkInitialize()
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Custom event details:

not able to parse rss feeds

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])

ASP MVC2 deploying to IIS 7 with error

after I deployed the application to IIS7 server, it seems fine at the beginning and can display the login page. But after the user inputted the username and password, I have to authenticate the user with the DB connection. At this time, it display error (attached). I guess the error is caused by the reflection during the EntityFramwork load the DB data.
My server has been installed .net framework 3.5 sp1 already.
On the other hand, I have tried another server. If a server has been installed VS2008 and MVC2 package for VS2008, that server can run the application properly in IIS7.
My aim is to run the application on a IIS7 server with .net framework 3.5 only.
Please help me solve this problem.
The error datails:
Server Error in '/FDDV_demo' Application.
--------------------------------------------------------------------------------
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
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.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
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:
[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]
System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark) +0
System.Reflection.Assembly.GetTypes() +111
System.Data.Metadata.Edm.AssemblyCacheEntry.LoadTypesFromAssembly(LoadingContext context) +28
System.Data.Metadata.Edm.AssemblyCacheEntry.InternalLoadAssemblyFromCache(LoadingContext context) +290
System.Data.Metadata.Edm.AssemblyCacheEntry.LoadAssemblyFromCache(Assembly assembly, Boolean loadReferencedAssemblies, Dictionary`2 knownAssemblies, Dictionary`2& typesInLoading, List`1& errors) +137
System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies) +284
System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyForType(Type type) +33
System.Data.Metadata.Edm.MetadataWorkspace.LoadAssemblyForType(Type type, Assembly callingAssembly) +80
System.Data.Objects.ObjectContext.CreateQuery(String queryString, ObjectParameter[] parameters) +106
FDDV.Models.DBEntities.get_user_master() +113
FDDV.Controllers.HomeController.validateUser(String userid, String password) +254
FDDV.Controllers.HomeController.LogOn(LogOnModel model, String returnUrl) +134
lambda_method(ExecutionScope , ControllerBase , Object[] ) +136
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +178
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +24
System.Web.Mvc.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a() +53
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +258
System.Web.Mvc.<>c__DisplayClassf.<InvokeActionMethodWithFilters>b__c() +20
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +193
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +316
System.Web.Mvc.Controller.ExecuteCore() +104
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +36
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__4() +34
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() +53
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +43
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8682542
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4955
I finally solved this problem. The main cause is the project missed some assembly references. I add the following code to the login function to find out the reflection type load exception. Once again, thanks everyone 's helpful
try{
//Do your work
}
catch (Exception ex)
{
ReflectionTypeLoadException exception = ex as ReflectionTypeLoadException;
if (exception == null)
System.IO.File.AppendAllText("C:\\TestLog.txt", "Not a ReflectionTypeLoadException ex.");
else
{
foreach (Exception loaderException in exception.LoaderExceptions)
{
System.IO.File.AppendAllText("C:\\TestLog.txt", loaderException.Message);
System.IO.File.AppendAllText("C:\\TestLog.txt", loaderException.StackTrace);
}
}
return true;
}
I faintly recall having a similar issue with MVC 3 when I upgraded a project from MVC 2 and had some version issues in my web.config.
Try enabling fusion assembly log binding and see if you can find maybe what the load is failing on.
http://www.hanselman.com/blog/BackToBasicsUsingFusionLogViewerToDebugObscureLoaderErrors.aspx
I found a script a while back that allowed me to work with fusion log better in IIS (I was having problems where it didn't run in IIS).

asp.net mvc custom model binder

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.

Server cannot set content type after HTTP headers have been sent

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.

Resources