Translate

Thursday 5 June 2014

Somee.com connection string

Somee.com connection string

introduction

I am currently using somee.com free hosting plan. Then I started to deploy my website everything was working fine except for database and membership database, and then I created a database from the hosting company [somee.com] they gave me a connection string but I was not sure how to integrate it to my website. I tried searching on Google but could not find a good code snippet to demonstrate, how to integrate some.com connection string to my website.
But I managed to solve this problem myself the only the only thing that I need to fix now is the membership database, so I can login, create users etcetera.

development environment connection string

This is the connection string I use in development environment
<connectionStrings>
  <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
   providerName="System.Data.SqlClient" />
 </connectionStrings>

production environment connection string

This is the connection string I use in production environment
  <connectionStrings>
    <add name="ApplicationServices" connectionString="workstation id=Bhubesi.mssql.somee.com;packet size=4096;user id=sizwe_SQLLogin_1;pwd=94rs8ez6pg;data source=Bhubesi.mssql.somee.com;persist security info=False;initial catalog=Bhubesi"  providerName="System.Data.SqlClient" />
  </connectionStrings>


Thursday 29 May 2014

Disabling User Accounts in ASP.NET C-Sharp

Disable User Account in Asp.net c-sharp

introduction

This application is about disabling logged in and logged out users by entering his or her UserName, and press the button to disable user’s account or approve a user.
We going to edit and update the IsApproved column in the aspnet_Membership table of the aspnetdb.mdf database, IsApproved column is a checkbox column which means it a Boolean data type that holds true or false.
But I won’t be working with checkboxes but will use two buttons instead, one holds true another holds false.

files

Default.aspx
Default.aspx.cs
ViewChanges.aspx
Web.config

Default.aspx
Default.aspx.cs
ViewChanges.aspx

Do not forget to use the following most important namespaces

using System.Data;
using System.Data.SqlClient;
using System.Web.Security;

without these namespaces, you will get a lot of errors

Before you debug please check the following

Please note this line of coding:
System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

The part with red text that says ConnectionString you need to change it, make it same as the name of your connection string.
To see the name of your connection string go to web.config file and open it in solution explorer and look out for a coding that looks like this:

       <connectionStrings>
  <add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"
   providerName="System.Data.SqlClient" />
 </connectionStrings>

You see that part that says name=” ConnectionString”, if it not the same as the red text copy and paste it on the red text that I was referring to.

testing

How to test it:
Right-click the Default.aspx file choose set as start page
Press the debug button or press F5
Enter the username inside the textbox.
Now press the disable user button, the user is now inactive.
Now click view changes hyperlink to see changes made
You can also activate the disabled user.

conclusion

Watch the video of this tutorial
If you see errors in this tutorial please notify me or just leave a comment.
If my tutorial helped you just leave a thank you message, it always nice if people give a feedback, it motivates you to do more
Thanks in advance for your lovely feedback!

Sunday 4 May 2014

Getting Started with C#

Are you interested in c# programming but don't know where to start?

In this blog I will focus more on ASP.NET C#

In this post I will try and guide you in the right direction


  • First thing you need is Microsoft Visual Studio, you can download it at http://www.visualstudio.com/downloads/download-visual-studio-vs

Friday 18 April 2014

Quadratic Equations Solver in C#

Quadratic equation solver console application

Your Quadratic equation must be in starndard form
ax2 + bx + c = 0
This console application will promt you to enter the value of a
Enter the value of a then press entter

And then it will prompt you to enter the value of b
Enter the value of b then press entter

Finaly it will prompt you to enter the value of c
Enter the value of c then press enter

Recover password by e-mail in asp.net c#

Recover password by e-mail


Files:

1.web.config
2.PasswordRecovery.aspx
3.PasswordRecovery.txt

you might want to check your smtp mail server here:

http://www.werockyourweb.com/list-outgoing-smtp-mail-servers

Create New User and email him or her an auto generated password

Create New User and email him or her an auto generated password

Objective
as you can see no password and confirm password , this is because AutoGeneratePassword =True
after the user is created he/she will be sent an email with password


Files:
1.Register.aspx
2.web.config
3.RandomPassword.txt

you might want to check your smtp mail server here:

http://www.werockyourweb.com/list-outgoing-smtp-mail-servers