As the title suggests, the following code converts a DateTime object to the “datetime-local” type used in HTML5 input controls (i.e. format 2016-10-30T00:00:00.00). I developed this while working on a personal application using C# and MongoDB. It uses the ToJson() function/method of the MongoDB Driver.
Datetime dt = new DateTime();
var dtLocal = dt.ToJson().ToString().Replace("ISODate(\"", "").Replace("Z\")", "");
Hopefully by posting this, it will help others save time.
I wrote this tip down for myself when I had problems getting the Ajax Control Toolkit MultiHandleSlider to work correctly in my application years ago. If you’re having difficulties as well, try setting the ID and BehaviorID properties to the same value.
My hosting provider is deprecating this information because there are newer methods of setting up logins and handling authentication, however, I believe this information is still invaluable to those who haven’t adopted the newer methods and/or can’t keep up with the pace of all the technological changes in the world (or don’t want to). And in the interest of preserving knowledge, here it is:
The following steps create the full Application Services database schema on our SQL Server database:
Open the command prompt on your local computer, and navigate to:
Execute the command:
aspnet_regsql.exe -S DBServerName -U DBLogin -P DBPassword -A all -d DBName
Currently, there is no management interface to manage the membership database other than using Visual Web Developer or creating your own application using the membership provider class. Here is an example of how to configure Visual Studio or Visual Web Developer to manage the membership database:
1. Create a web application in Visual Web Developer or Visual Studio.
2. Open the web.config file.
3. The default membership provider uses a connection string called “LocalSqlServer”. Therefore, replace:
<add name="LocalSqlServer" connectionString="Data Source=DBServerName;Integrated Security=false;Initial Catalog=DBName;User ID=DBLogin;Password=DBPassword" providerName="System.Data.SqlClient"></add>
4. Save and close the web.config file.
5. Go to Website menu and run the ASP.NET Configuration tool. This will open the Web Site Administration tool.
6. In the Web Site Administration tool, go to the Security tab.
7. Click on “Select authentication type”.
8. Select “From the internet”. Click the Done button.
9. Create your admin roles and users.
10. Then create access rules.
11. Create a rule that applies to the “Anonymous users” with “Deny” permissions.
12. Create another rule that applies to the admin role you created with “Allow” permissions.
Your application is now ready to use the membership provider, and you can begin creating your log in forms.