Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6970085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:39:53+00:00 2026-05-27T16:39:53+00:00

How can i insert login view to every page in my asp.net mvc 2.0

  • 0

How can i insert login view to every page in my asp.net mvc 2.0 project?
I have “stolen” this controllers, and view’s from Non empty project of MS visual studio 2010. How can i insert login form on every view?
I need to use such thing as in php: include. What is in asp.net mvc? ascx???
Here is main.master:

    <%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
    <title>
        <asp:ContentPlaceHolder ID="TitleContent" runat="server" />
    </title>
    <asp:ContentPlaceHolder ID="HeadContent" runat="server" />
    <link href="/Content/Site.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div class="header">
        <img src="/Content/image/img_06.jpg" width="320" height="192" /></div>
    <div class="naviheader">
        <div class="navl">
        </div>
        <a href="/Home" class="navitext">На главную</a> <a href="/Shedule" class="navitext">
            Расписание</a> <a href="/Home/About" class="navitext">О нас</a> <a href="/Admin"
                class="navitext">АдминПанель</a>
    </div>
    <div id="middle">
        <div id="container">
            <div id="content">
                <asp:ContentPlaceHolder ID="MainContent" runat="server">
                </asp:ContentPlaceHolder>
            </div>
            <!-- #content-->
        </div>
        <!-- #container-->
        <div class="sidebar" id="sideLeft">
            <asp:ContentPlaceHolder ID="Login" runat="server">
                <% Html.RenderPartial("Login"); %>
            </asp:ContentPlaceHolder>
        </div>
</body>
</html>

where and what i must insert?
here is login view(aspx):

  <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Main.Master" Inherits="System.Web.Mvc.ViewPage<TrainShedule.Models.LogOnModel>" %>

<asp:Content ID="loginTitle" ContentPlaceHolderID="TitleContent" runat="server">
    Log On
</asp:Content>

<asp:Content ID="loginContent" ContentPlaceHolderID="MainContent" runat="server">
    <h2>Log On</h2>
    <p>
        Введите свой логин и пароль:
    </p>

    <% using (Html.BeginForm()) { %>
        <%= Html.ValidationSummary(true, "Login was unsuccessful. Please correct the errors and try again.") %>
        <div>
            <fieldset>
                <legend>Ввод данных:</legend>

                <div class="editor-label">
                    <%= Html.LabelFor(m => m.UserName) %>
                </div>
                <div class="editor-field">
                    <%= Html.TextBoxFor(m => m.UserName) %>
                    <%= Html.ValidationMessageFor(m => m.UserName) %>
                </div>

                <div class="editor-label">
                    <%= Html.LabelFor(m => m.Password) %>
                </div>
                <div class="editor-field">
                    <%= Html.PasswordFor(m => m.Password) %>
                    <%= Html.ValidationMessageFor(m => m.Password) %>
                </div>

                <div class="editor-label">
                    <%= Html.CheckBoxFor(m => m.RememberMe) %>
                    <%= Html.LabelFor(m => m.RememberMe) %>
                </div>

                <p>
                    <input type="submit" value="Log On" />
                </p>
            </fieldset>
        </div>
    <% } %>
</asp:Content>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:39:54+00:00Added an answer on May 27, 2026 at 4:39 pm

    First you will need to change your login view page (aspx) to a user contorl (ascx). This shouldn’t be too difficult; copying and pasting with some tweaks should do it.

    Once you have your control you can add it to your master page and it will appear on all pages which use the master page. There are 2 ways to add the control to the page.

    1. Drag the UserControl onto the designer surface
      enter image description here

    2. Html.RenderUserControl
      enter image description here

    The following link will help alot. asp.net mvc usercontrols start to finish.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am considering the StringTemplate view engine for my ASP.NET MVC application. This application
I'm trying to create a create model object page. I'm using asp.net mvc with
Is there a way that I can insert values into a VB.NET Dictionary when
I have a DataSet that I have added to my project where I can
I can insert a row by using code below. USE pmdb; INSERT INTO md5_tbl
I can insert annotations on specific datasets on the graph but I wish to
how can insert a record if only a specific value doesn't exist in a
EntityManager.merge() can insert new objects and update existing ones. Why would one want to
Using the code below I can insert a new row to my table (
I need to know how I can insert data inside objects inside an array

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.