TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Duminda Dissanayake
NA
11
656
visual studio 2013 MVC 4
Jan 12 2016 4:50 AM
In visual studio 2013 MVC 4 I'm getting below mention error when calling action in controller
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
I need help to solve this. here my code
public class PasswordGeneratorController : BaseController
{
//
// GET: /PasswordGenerator/
public ActionResult PasswordGenerator()
{
PasswordGeneratorViewModel viewModel = new PasswordGeneratorViewModel();
ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
return View(Constant.ViewPasswordGenerator, viewModel);
}
public ActionResult Clear()
{
PasswordGeneratorViewModel VM = new PasswordGeneratorViewModel();
VM.strKeyValue = "";
VM.strPassword = "";
return View(Constant.ViewPasswordGenerator, VM);
}
public ActionResult GeneratePassword()
{
string strpassword = string.Empty;
PasswordGeneratorViewModel VM = new PasswordGeneratorViewModel();
TryUpdateModel<PasswordGeneratorViewModel>(VM);
try
{
if (VM.strKeyValue.ToString().Trim() != "")
{
ModelState.Remove("strPassword");
strpassword = VM.strKeyValue.ToString().Trim() + CurrentUserName.ToString().Trim();
//strpassword = VM.strKeyValue.ToString().Trim() + "reyazmihular";
VM.strPassword = this.Encrypt(strpassword, "");
}
return View(Constant.ViewPasswordGenerator, VM);
}
catch (Exception ex)
{
throw ex;
}
}
private string Encrypt(string password, string salt)
{
//byte[] passwordBytes = Encoding.Unicode.GetBytes(password);
//byte[] saltBytes = Encoding.Unicode.GetBytes(salt);
//byte[] cipherBytes = ProtectedData.Protect(passwordBytes, saltBytes, DataProtectionScope.CurrentUser);
//return Convert.ToBase64String(cipherBytes);
string strmsg = string.Empty;
byte[] encode = new byte[password.Length];
encode = Encoding.UTF8.GetBytes(password);
strmsg = Convert.ToBase64String(encode);
return strmsg;
}
private string Decrypt(string password, string salt)
{
password = "NTk2MDY4MjNyZXlhem1paHVsYXI=";
string decryptpwd = string.Empty;
UTF8Encoding encodepwd = new UTF8Encoding();
Decoder Decode = encodepwd.GetDecoder();
byte[] todecode_byte = Convert.FromBase64String(password);
int charCount = Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
char[] decoded_char = new char[charCount];
Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
decryptpwd = new String(decoded_char);
return decryptpwd;
}
}
------------------------------------------------------------------------
View
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="KPMG.PasswordGenerator.Web.Common.BaseViewPage<KPMG.PasswordGenerator.Web.ViewModel.PasswordGeneratorViewModel>" %>
<%@ Import Namespace="KPMG.PasswordGenerator.Web.App_LocalResources" %>
<%@ Import Namespace="KPMG.PasswordGenerator.Web.Common" %>
<%@ Import Namespace="KPMG.PasswordGenerator.Web.Models" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript" lang="javascript">
function GeneratePassword() {
document.forms[0].submit();
}
</script>
<script type="text/javascript" src="~/Scripts/PasswordGeneratorScript.js"> </script>
<div class="breadbrumb">
<div id="buttonrow" class="paddinright10px">
<input id="btnClear" type="submit" value="Clear" class="btncancel marginright15px" " onclick="location.href = ' @Url.Action(Constant.ActionPasswordClear, Constant.ControllerPasswordGenerator) ' " />
<input id="butGenerator" type="submit" value="Generate" class="btnsearch marginright15px" onclick="GeneratePassword()" />
</div>
</div>
<div>
<%=Html.ValidationSummary()%>
<% Html.BeginForm(Constant.ActionGeneratePassword, Constant.ControllerPasswordGenerator, FormMethod.Post, new { id = "submitForm" }); %>
</div>
<div class="clear">
</div>
<div class="boxSpecialOne">
<div class="InnerrRowFloatLeft" id="longText">
<div class="lableleftcoloumn">
<label>
<%=PasswordGeneratorViewResource.KeyLabel%>
</label>
<label class="mandatoryLabel">
<%=PasswordGeneratorViewResource.MandatoryLabel%>
</label>
</div>
<%=Html.TextBoxFor(model => model.strKeyValue, new {maxlength = "300",@class=Constant.CssClassMandatoryField })%>
</div>
<div class="InnerrRowFloatLeft" id="idComments">
<div class="lableleftcoloumn">
<label>
<%=PasswordGeneratorViewResource.PasswordLabel%>
</label>
<label class="mandatoryLabel">
<%=PasswordGeneratorViewResource.MandatoryLabel%>
</label>
</div>
<%=Html.TextAreaFor(model => model.strPassword, new {style = "width:1050px;height:50px",maxlength = "300",@class=Constant.CssClassMandatoryField })%>
</div>
</div>
<% Html.EndForm();%>
</asp:Content>
Reply
Answers (
10
)
Facebook Share Link can't grab current ASP.NET URL, HELP!
How to retrieve data from database to datagridcomboboxcell