milosev.com
  • Home
    • List all categories
    • Sitemap
  • Downloads
    • WebSphere
    • Hitachi902
    • Hospital
    • Kryptonite
    • OCR
    • APK
  • About me
    • Gallery
      • Italy2022
      • Côte d'Azur 2024
    • Curriculum vitae
      • Resume
      • Lebenslauf
    • Social networks
      • Facebook
      • Twitter
      • LinkedIn
      • Xing
      • GitHub
      • Google Maps
      • Sports tracker
    • Adventures planning
  1. You are here:  
  2. Home

AccountController

Details
Written by: Stanko Milosev
Category: MVC 3
Published: 08 January 2013
Last Updated: 04 July 2013
Hits: 5654

If on

Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus);

You are receiveng messages like:

The user instance login flag is not supported on this version of SQL Server. The connection will be closed.

or

Unable to connect to SQL Server database.

Then check in your Web.config file:

add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"

<connectionStrings>
<add name="ApplicationServices"
connectionString="Data Source=MyPC;

Connection string name must be same as name of SqlMembershipProvider connection string.

If after you receive error like:

Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.

Then in command prompt execute something like:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regsql.exe -S MyServer -U MyUserId -P myPass -A all -d MyDb

And if you receive error like:

Generating user instances in SQL Server is disabled. Use sp_configure 'user instances enabled' to generate user instances

Then in MS SQL Server execute:

exec sp_configure 'user instances enabled', 1 Reconfigure

and restart server...

Would you like to share your location with...

Details
Written by: Stanko Milosev
Category: MVC 3
Published: 26 December 2012
Last Updated: 11 February 2013
Hits: 5311

If you are receiving similar message, then there is code some part which is trying to determine your location. In my case problem was with Bing maps:

mm.GeoLocationProvider(this.map).getCurrentPosition({

In other cases search for GeoLocation.

There is already an open DataReader associated with this Command which must be closed first.

Details
Written by: Stanko Milosev
Category: MVC 3
Published: 12 November 2012
Last Updated: 12 November 2012
Hits: 5245
If you are receiving error message as in title, then in connection string add:

multipleactiveresultsets=True

Something like:

<add name="MyDbContext" 
connectionString="
  Data Source=myServer;Initial Catalog=MyDb;
  Persist Security Info=True;
  Integrated Security=True;
  multipleactiveresultsets=True
" />

Writing HTML Helpers

Details
Written by: Stanko Milosev
Category: MVC 3
Published: 05 August 2012
Last Updated: 05 August 2012
Hits: 5298

Writing HTML Helpers
page 330,
book Professional ASP.NET MVC 3

For example in: \MvcApplication1\MvcApplication1\Core\Extensions.cs write something like:

using System;
using System.IO;
using System.Web.Mvc;

namespace MvcApplication1.Core
{
    public static class HtmlExtensions
    {
        private class Extensions : IDisposable
        {
            private readonly TextWriter _writer;

            public Extensions(TextWriter writer)
            {
                _writer = writer;
            }

            public void Dispose()
            {
                _writer.Write("</table>");
            }
        } //private class Extensions : IDisposable

        //note that this part is not under private class Extensions : IDisposable
        public static IDisposable Begin(this HtmlHelper html)
        {
            var writer = html.ViewContext.Writer;
            writer.Write("<table>");
            return new Extensions(writer);
        }
    }
}

And in: \MvcApplication1\MvcApplication1\Views\Stanko\Index.cshtml Something like:

@using (Html.Begin())
{
}

after starting app in the HTML source I will see tag <table></table> from here

  1. Routing
  2. DbContext
  3. Non-identity id key
  4. Example

Subcategories

C#

Azure

ASP.NET

JavaScript

Software Development Philosophy

MS SQL

IBM WebSphere MQ

MySQL

Joomla

Delphi

PHP

Windows

Life

Lazarus

Downloads

Android

CSS

Chrome

HTML

Linux

Eclipse

Page 47 of 168

  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51