Click here to Skip to main content
15,888,610 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Localization - Unable to use any Actions from Pages in Navigation Bar if Arabic language is set Pin
RajeeshMenoth18-Feb-15 23:02
professionalRajeeshMenoth18-Feb-15 23:02 
Rant[REPOST] Localization - Unable to use any Actions from Pages in Navigation Bar if Arabic language is set Pin
Richard Deeming19-Feb-15 2:25
mveRichard Deeming19-Feb-15 2:25 
QuestionHow to pass JavaScript variable to another page? Pin
samflex18-Feb-15 16:04
samflex18-Feb-15 16:04 
AnswerRe: How to pass JavaScript variable to another page? Pin
F-ES Sitecore18-Feb-15 23:40
professionalF-ES Sitecore18-Feb-15 23:40 
AnswerRe: How to pass JavaScript variable to another page? Pin
Member 1143449224-Feb-15 0:10
Member 1143449224-Feb-15 0:10 
QuestionMVC 5 Newbie Question - Plugins, Packages? Pin
jkirkerx18-Feb-15 6:45
professionaljkirkerx18-Feb-15 6:45 
Answer[GOT IT] You can modify the Simple Membership Pin
jkirkerx19-Feb-15 11:05
professionaljkirkerx19-Feb-15 11:05 
GeneralRegsiter User, it works but not sure if it's done right for MVC Pin
jkirkerx19-Feb-15 13:32
professionaljkirkerx19-Feb-15 13:32 
Not sure if I did this right, but I had to get the Register working.
So I modified the ActionResult register
[HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                try
                {
                    WebSecurity.CreateUserAndAccount(model.UserName, model.Password);
                    int userID = WebSecurity.GetUserId(model.UserName);
                    bool s = WebSecurityExtender.UpdateUserAndAccount(userID, model.Name, model.CompanyName, model.EmailAddress);

                    WebSecurity.Login(model.UserName, model.Password);
                    return RedirectToAction("Index", "Home");
                }
                catch (MembershipCreateUserException e)
                {
                    ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }

And wrote sort of an extender in App_Code
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;


namespace WebMatrix.WebData
{
    public class WebSecurityExtender
    {

        public static bool UpdateUserAndAccount(int userID, string name, string companyName, string emailAddress)
        {
            bool success = false;
            string connStr = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
            SqlConnection conn = new SqlConnection(connStr);

            string query =
            "UPDATE " +
            " UserProfile " +
            "SET " +
            "  Name = @Name " +
            " ,CompanyName = @CompanyName " +
            " ,EmailAddress = @EmailAddress " +
            " WHERE UserID = @UserID ";

            SqlCommand cmd = new SqlCommand(query, conn);

            cmd.Parameters.Add(new SqlParameter("@UserID", userID));
            cmd.Parameters.Add(new SqlParameter("@Name", name));
            cmd.Parameters.Add(new SqlParameter("@CompanyName", companyName));
            cmd.Parameters.Add(new SqlParameter("@EmailAddress", emailAddress));     

            try
            {
                conn.Open();
                cmd.BeginExecuteNonQuery();                                

            }
            finally
            {
                conn.Close();

            }

            return success;
        }
    }
}


This is my first time working with MVC and C-Sharpe, and I know I could of done better in the database call, but I really had nothing to go on here. I need to add the catch as well.
QuestionWeb api works on localhost, but not on deployement server Pin
Member 1092967518-Feb-15 5:40
Member 1092967518-Feb-15 5:40 
QuestionUsing SQL Server CONTEXT_INFO feature in ASP.Net + Enterprise Library (v5 & above) Pin
Member 317000018-Feb-15 1:54
Member 317000018-Feb-15 1:54 
QuestionMVC 5, creating a download exe file link Pin
jkirkerx16-Feb-15 11:01
professionaljkirkerx16-Feb-15 11:01 
AnswerRe: MVC 5, creating a download exe file link Pin
Richard Deeming16-Feb-15 11:22
mveRichard Deeming16-Feb-15 11:22 
GeneralOh that's pretty slick Pin
jkirkerx16-Feb-15 11:40
professionaljkirkerx16-Feb-15 11:40 
GeneralRe: Oh that's pretty slick Pin
Richard Deeming16-Feb-15 12:06
mveRichard Deeming16-Feb-15 12:06 
GeneralRe: Oh that's pretty slick Pin
jkirkerx16-Feb-15 12:56
professionaljkirkerx16-Feb-15 12:56 
GeneralRe: Oh that's pretty slick Pin
Richard Deeming17-Feb-15 3:12
mveRichard Deeming17-Feb-15 3:12 
GeneralRe: Oh that's pretty slick Pin
jkirkerx17-Feb-15 8:01
professionaljkirkerx17-Feb-15 8:01 
QuestionMVC Template Pin
mlaitat16-Feb-15 1:07
mlaitat16-Feb-15 1:07 
AnswerRe: MVC Template Pin
Dave Kreskowiak16-Feb-15 14:31
mveDave Kreskowiak16-Feb-15 14:31 
QuestionWhich is more secure cms in asp.net web development ? Customized cms or Third party cms(DNN,umbraco,etc) Pin
RajeeshMenoth15-Feb-15 20:22
professionalRajeeshMenoth15-Feb-15 20:22 
AnswerRe: Which is more secure cms in asp.net web development ? Customized cms or Third party cms(DNN,umbraco,etc) Pin
Dave Kreskowiak16-Feb-15 14:32
mveDave Kreskowiak16-Feb-15 14:32 
GeneralRe: Which is more secure cms in asp.net web development ? Customized cms or Third party cms(DNN,umbraco,etc) Pin
RajeeshMenoth16-Feb-15 17:03
professionalRajeeshMenoth16-Feb-15 17:03 
GeneralRe: Which is more secure cms in asp.net web development ? Customized cms or Third party cms(DNN,umbraco,etc) Pin
Dave Kreskowiak16-Feb-15 17:59
mveDave Kreskowiak16-Feb-15 17:59 
Questionnavigation method Pin
Member 1145476815-Feb-15 20:14
Member 1145476815-Feb-15 20:14 
AnswerRe: navigation method Pin
Dave Kreskowiak16-Feb-15 14:34
mveDave Kreskowiak16-Feb-15 14:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.