.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Invalid Password message on View From COntroller

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :ASP.Net

If the password is invalid, how can I show "Invalid Password"on view ?

   <% Html.EnableClientValidation(); %>
   <% using (Html.BeginForm("Submit", "MyController", FormMethod.Post))
   <%= Html.ValidationSummary(true) %>
   <div><b><%= Html.LabelFor(x => x.UserModel.Password)%>:  </b><%= Html.PasswordFor(x => x.UserModel.Password)%>
   <%= Html.ValidationMessageFor(x => x.UserModel.Password)%>
    <input type="submit" name="submitButton" value="Accept"   />
    <% } %>


 bool isAuthenticate = IsAuthenticate(...);
    if (!isAuthenticate)
        return View("MyPasswordView", UserModel);



View Complete Post

More Related Resource Links

Model View Controller (MVC) for ASP.NET

Model View Controller (MVC) architectures, immediately wonder how the MVC pattern can be applied in an ASP.NET world. This article will demonstrate how the MVC pattern can be applied to an ASP.NET web application and still maintain the basic Microsoft supplied architecture.

XML Task error message hexadecimal invalid character

I am developing a SSIS package to add data from an XML file to an existing SQL Server table.  I have completed several similar projects, but on this XML file I am getting the error from the Data Flow tab between the XML Task and Data Flow Task: Error: 0xC002F304 at XML Task, XML Task: An error occurred with the following error message: "'', hexadecimal value 0x15, is an invalid character. Line 28, position 54.". Error: 0xC002928F at XML Task, XML Task: Property "New Source" has no source Xml text; Xml Text is either invalid, null or empty string. Task failed: XML Task Warning: 0x80019002 at zSTU_TS_Element: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (2) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors. SSIS package "zStu_TS_Element.dtsx" finished: Failure. Do you know how I can fix this? This is the line it is referring to: <z:row c0='12' c1='80' c2='2006-04-17' c3='539' c4='1M2083N4N5N6N75800901110 11 '/>

Is it bad MVC practice to return a view of a different controller?

I came upon this when had problem trying to return a view of a different controller.  In controller1, I have view view1.In Action1 of controller2, I wanted to do something like:public ViewResult Action1(){     return View("/Controller1/View1");}but, found out, I couldn't do it.  So I searched and found this: http://stackoverflow.com/questions/879852/asp-net-mvc-display-a-view-from-another-controllerOne guy there responded and said that, for my case, it is possible to do things like below:return View("~/Views/Controller1/View1.aspx");But, please let me know if this is considered an acceptable MVC practice.  Is it OK, good, perfect to do so in the asp.net MVC realm?  Thanks, please share your two cents.

SPD message - The URL ../../_catalogs/masterpage is invalid

When I open a page on one of my SP (MOSS 2007) sites using SharePoint Designer I get a pop-up with this error. I click OK and the page seems to load fine... as far as I can tell. These pages are in a publishing site, but aren't under the control of the publishing feature - they are forms for a list.   I've searched around for some info on this error and have found a lot of solutions for masterpage, but nothing for this one specificaly related to SPD. Any thoughts?   Thanks! Brent

The specified view is invalid error when browsing for images

Hello All, Currently using MOSS 2007 publishing site and using the CMS elements to publish content to the web.  One of our users is experiencing a strange problem whereby when they try to insert an image into the Sharepoint content editor using the Insert Picture functionality they get the following error when trying to browse to an image: The specified view is invalid.   at Microsoft.Sharepoint.SPViewCollection.get_Item(String strDisplayName) at Microsoft.Sharepoint.Publishing.Internal.States.AssetPickerDetailState.InitGridView(GridView grid) at Microsoft.Sharepoint.Publishing.Internal.States.AssetPickerDetailState.Configure(SMObjectList objectlist) at Microsoft.Sharepoint.Publishing.Internal.WebControls.SMObjectList.Handle_LoadCompleteEvent(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.UI.Page.OnLoadComplete(EventArgs e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) Only one user is experiencing this problem, others are fine. Does anyone have ANY ideas what is causing this issue or how to fix it? Thanks

General Controller to View logic question

Hello, I am currently learning the MVC2 Framework and I have a brief question in terms of my logic and if their are any flaws in it. I created a basic example in a couple of minutes that demonstrates the way I think about it. public ViewResult Index() { return View(); } public ViewResult Cookies() { return View(new Cookie()); } public ViewResult CookiesInput(Cookie cookie) { return View(cookie); }<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h2>I really like cookies</h2> Would you like a cookie? <% using (Html.BeginForm("Cookies", "Example")) { %> <p><input type="submit" value="Yes" /></p> <% } %> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h2>Cookies</h2> <% using (Html.BeginForm("CookiesInput", "Example")) { %> <%= Html.EditorForModel() %> <p><input type="submit" value="Gimme" /></p> <% } %> </asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainConten

Passing objects between View and Controller

 I would like to pass List<SelectListItem> (not selected item but the whole "List" object) back to controller.for example in my GET controller i would have thisViewData["list"] = some select list from repository;then on post I would like to get the list back from view..pretty much i'm trying to use ViewData["list"] as storage..this way I would use ajax to remove or add items to/from the list.what's the best approach ?thanks

The specified view is invalid for web part created during feature activiated

I have some code executing during the Feature Activated event. During this process, I try to insert a list view web part into a page, setting the viewGuid to a custom view already created. But I keep getting the error about the view being invalid. After the feature is activiated, I go through the UI and select the view and the web part uses it just fine. What is going on? Does anyone have a thought, link to answer? I'm sure others have come across this before.

How to show a message box on an invalid filename entered while saving a file using save file dialog

Hi all i have written a code to display a message box if invalid characters are entered while saving the file but my message box is not displaying. Actually i will have a save file dialog option to save a file if the filename starts or consists of the following    \\/:*?<>|"  I would like to display a message box as invalid or illegalcharacters in file My code is as follows    Stream myStream;                          SaveFileDialog saveFileDialog1 = new SaveFileDialog();                            saveFileDialog1.InitialDirectory = @"C:\";                          saveFileDialog1.DefaultExt = "txt";                          saveFileDialog1.Filter = "(*.txt)|*.txt";                          saveFileDialog1.FilterIndex = 2;                          saveFileDialog1.RestoreDirectory = true;                            if (saveFileDialog1.ShowDialog() == DialogR

Error message in opening a view after Replication server restored

Hi, Yesterday Replication was broken as Publisher was down. After it was restored, I tried to open a view in Subscriber and I get the following error message [Microsoft] [ODBC SQL Server Driver] [SQL Server] Login failed for user 'Repl admin'   Any suggestions to get around this problem.   Thanks in advance -Jaya

How to retrieve url from another view of controller by code


Dear all

I want to know url of View from another controller.  The following is structure







Now, I want to goto Index view of controller Home from view Login of controller Account

I know  I can use method this.RediectToAction("Index", "Home") to do it but I don't want to method.  It will fail to redirect when view or controller renamed.

Please help



Dear All,

I have

- controller (customer)

public class customer{

public string Name { get; set; }

public string sex {get;set;}


- model (customermodel)

public class customermodel{

public string Name { get; set; }

public string sex {get;set;}


- view (index.aspx)

so i want to transfers presentation model to view (use IList and IEnumberable), how can i do? after i want to display data from database, how can i do ?



error message customization in create user wizard, change password wizard


Hi All,

Create User Wiard and Change Password Wizard contain error message literals. They display error messages when a user is trying to sign up with an username that already exists and so on.

These error messages are pre-set. How can they be customized. In particular, how can they be adjusted depending on the language.

How is this usually best achieved?

Thanks a lot.


view soap request message


I am consuming a .net 2.0 webservice from a class library and calling this class from a web page form . When a user inputs and saves the data in the form it will call the class and inturn send the user inputted data over webservice. I want to view the Soap messages like request and response going from my dll to the webservice. I tried fiddler but with no luck. So I created a class mentioned here: http://msdn.microsoft.com/en-us/library/system.web.services.protocols.soapextension(v=VS.90).aspx

and added the in the dll.config file like this and it was also of no help. By the way the end webservice is https not http.




        <add type="SoapTrace.TraceExtension" priority="2" group="High" />





Any pointers are greatly appreciated, thanks in advance

problem when passing data from view back to controller?


I have following situation - I am pasing user info object from Controller to View. It contains GUID UserID,  which i dont want to be seen on page.

So I  removed every   Html.LabelFor(model => model.UserID), Html.TextBoxFor(model => model.UserID) etc... from generated View source.

And because of this when Html.BeginForm() returns that object back to Controller  all values is there but UserID is lost??

If I leave Html.LabelFor(model => model.UserID), Html.TextBoxFor(model => model.UserID) etc.. in View everything is fine.

But I dont want to show UserID?

Where is the problem here?

                <%= Html.LabelFor(model => model.C__User_Id) %>

data lost in transition from view->controller


MVC basics or looks like I am doing something terribly wrong, but have not slightly idea what is it?

Want to delete user from MVC Framework's Built in Security Module.

So first I define Delete() in AccountController:

        public ActionResult DeleteUser()


            User_Repository urp = new User_Repository();

            aspnet_Users currUser = urp.Get_AspNet_User(HttpContext.User.Identity.Name);

            return View(currUser);


and this works fine.


I added view (for delete) DeleteUser.aspx


<h3>Are you sure you want to delete this?</h3>




        <div class="display-label">UserId</div>

        <div class="display-field"><%= Html.Encode(Model.UserId) %></div>


        <div class="display-label">UserName</div>

        <div class="display-field"><%= Html.Encode(Model.UserName) %>&

error message on clicking a specific view


Hi there,

Please find below the description of my problem:

When I click on a view(eg. Doc Type/Sub Doc Type in our case), I am shown the error message "<!-- #RENDER FAILED -->". Basically what we do is a migration of data(mostly documents) from Webdocs to Sharepoint. So each Business Unit that we migrate has variable item count as 750, 2500, 13000 and so on. There is no problem with Business Units(BU) having, say less than 2000 items in Doc library, but for BUs more than this item count we get this error msg.Is there a workaround for this?. Also I've tried to limit the no. of items shown and other options but in vain.




ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend