asp.net 4.5.2, html5 etc

Our site is on https. However, we need to embed an iframe which calls out to a service that is not available over https.

Chrome blocks this so the embedded content does not display.

Is there any way in asp.net config to reliably force this content to be displayed in spite of it only being available over http?

I want to add web reference of ssl enabled web service in order to generate proxy classes. when i am trying to do so, i am getting an exception "Unable to download wsdl". I am adding web service reference from solution explorer with the help of wizard. I am sharing screenshots. https://i.stack.imgur.com/fNeI4.png , https://i.stack.imgur.com/AQQqm.png

In my MVC view, I am opening a modal dialog which renders a PartialView as RenderAction. The view is opened when user click Add button for the specific row like below.

enter image description here

From the main view, I want to pass the current row's (select row) ProjectNo, DrawingNo and RevisionNo. Also, preferrably I want to pass this into the respective ViewBag's fields. How can I achieve this?

Here is the source code where I am calling the dialog.

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="myModalLabel">Enter Fabrication Information</h4>
        </div>
        <div class="modal-body">
            <div>
                @{Html.RenderAction("Create", "Fabrication", new BPs.Entities.FABRICATION { });}
            </div>
        </div>
    </div>
</div>

I'm new to ASP.NET programming and I've got a task to create a sort of a web application with a hierarchical list of infos from a database. Should be something like this + with options to add, edit, and delete stuff in the database.

enter image description here

What I did by now is:

The view file:

    @model IEnumerable<MVC_APP.Models.Hierarchy>
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
</head>
<body>
    <div>
        @foreach (var item in Model)
        {
        <ul>
            <li>@item.NAME</li>
        </ul>
        }
    </div>
</body>
</html>

The controller:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MVC_APP.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/
        private Models.Test_Site_DBEntities db = new Models.Test_Site_DBEntities();
        public ActionResult Index()
        {
            var Items = db.Hierarchies;
            return View(Items);
        }

    }
}

Please, explain what to do next, what to use, and how it all works. Thank you in advance!

What I need: TARGET or ACTUAL on first line and rest on next line.

enter image description here

What I have till now

enter image description here

I have this gridview templatefield in asp.net

<asp:TemplateField HeaderStyle-CssClass="headerStyle" HeaderText="TARGET Approval Date" FooterStyle-CssClass="alternateStyler" ItemStyle-CssClass="alternateStyler" ItemStyle-Width="8%" ItemStyle-VerticalAlign="Top" FooterStyle-VerticalAlign="Top">
    <ItemTemplate>
        <asp:TextBox ID="dtTgtApprDate" CssClass="Datetext" Width="98%" Height="23px" runat="server" Text='<%# Eval("Phase2")%>'></asp:TextBox>
            </ItemTemplate>
            <FooterTemplate>
                <asp:TextBox ID="dtTgtApprDate2" CssClass="Datetext" Width="98%" Height="23px" runat="server">
                </asp:TextBox>
            </FooterTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderStyle-CssClass="headerStyle" HeaderText="ACTUAL Approval Date" FooterStyle-CssClass="alternateStyler" ItemStyle-CssClass="alternateStyler" ItemStyle-Width="8%" ItemStyle-VerticalAlign="Top" FooterStyle-VerticalAlign="Top">
            <ItemTemplate>
                <asp:TextBox ID="dtActApprDate" CssClass="Datetext" Width="98%" Height="23px" runat="server" Text='<%# Eval("Phase3")%>'></asp:TextBox>
                    </ItemTemplate>
                    <FooterTemplate>
                        <asp:TextBox ID="dtActApprDate2" CssClass="Datetext" Width="98%" Height="23px" runat="server">
                        </asp:TextBox>
                    </FooterTemplate>
                </asp:TemplateField>

I have put this css for HeaderStyle-CssClass="headerStyle"

.headerStyle {
    text-justify:distribute;
}

My RouteConfig.cs

public static class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("{*allaspx}", new {allaspx = @".*\.aspx(/.*)?"});
            routes.IgnoreRoute("{*allasmx}", new { allasmx = @".*\.asmx(/.*)?" });
            routes.IgnoreRoute("{*allsvc}", new { allsvc= @".*\.svc(/.*)?" });
            routes.IgnoreRoute("{*allFileAttachments}", new { allattachment = @".*\file.attachment(/.*)?" });
            ...
            ...
            ...
       }
   }

Web.config

<configuration>
....
<system.web>
<httpHandlers>
 <add path="*.attachment" verb="*" type="MyType, Namespace" />
</httpHandlers>
</system.web>
<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
  <handlers>
<remove name="attachmentHandler" />
      <add name="attachmentHandler" verb="*" path="*.attachment" type="myType, namespace" preCondition="integratedMode" />
</handlers>
...
</system.webServer>
...
</configuration>

When I try accessing the following URL, it still tries to find a controller and fails with 404

http://localhost/somepath/file.attachment?4535345343

I am beginner in ASP.NET MVC and trying to Database access with Entity Framework Code-First but I am getting an error. I saw many questions on stackoverflow but they are not relevant to my situation. My error is.

An exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll but was not handled in user code

Additional information: Unable to complete operation. The supplied SqlConnection does not specify an initial catalog or AttachDBFileName.

in LensStoreController.cs at var brands = lensStoreDB.Brands.ToList(); line

LensStoreController.cs

public ActionResult Index()
{
    var brands = lensStoreDB.Brands.ToList();
    return View(brands);
}

Brands.cs, Lenses.cs and Manufacturer.cs are my Model classes

Brand.cs

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace EyeContactLens.Models
{
    public class Brands
    {
        [Key]
        public int BrandId { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public List<Lenses> Lenses { get; set; }

    }

}

Lenses.cs

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace EyeContactLens.Models
{
    public class Lenses
    {
        [Key]
        public int LensesId { get; set; }
        public int BrandId { get; set; }
        public int ManufacturerId { get; set; }
        public string Title { get; set; }
        public decimal Price { get; set; }
        public string LensManuUrl { get; set; }
        public Brands Brand { get; set; }
        public Manufacturer Manufacturer { get; set; }
    }
}

Manufacturer.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace EyeContactLens.Models
{
    public class Manufacturer
    {
        public int ManufacturerId { get; set; }
        public string Name { get; set; }
    }
}

I have one more class SampleData.cs, whose data I want to show on browser.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;

namespace EyeContactLens.Models
{
    public class SampleData : DropCreateDatabaseIfModelChanges<EyeContactLensEntities>
    {
        protected override void Seed(EyeContactLensEntities context)
        {
            var brands = new List<Brands>
            {
                new Brands { Name = "Cooper Vision"},
                new Brands { Name = "Fresh Kon"},
                new Brands { Name = "Flexcon"},
                new Brands { Name = "Avaira"},
            };

            var manufacturer = new List<Manufacturer>
            {
                 new Manufacturer { Name = "Oculus"},
                 new Manufacturer { Name = "Alcon (CIBA Vision)"}
            };

            new List<Lenses>
            {
                new Lenses { Title = "Biofinity Contact Lens", Brand = brands.Single(b => b.Name == "Cooper Vision"), Price = 8.99M, Manufacturer = manufacturer.Single(a => a.Name == "Alcon (CIBA Vision)"), LensManuUrl = "/Content/Images/placeholder.gif" },
                new Lenses { Title = "FreshKon A55", Brand = brands.Single(b => b.Name == "Fresh Kon"), Price = 18.99M, Manufacturer = manufacturer.Single(a => a.Name == "Oculus"), LensManuUrl = "/Content/Images/placeholder.gif" },
                new Lenses { Title = "Flexcon Blue Tint UV Prolong wear (BUPW) (45%)", Brand = brands.Single(b => b.Name == "Flexcon"), Price = 81.99M, Manufacturer = manufacturer.Single(a => a.Name == "Oculus"), LensManuUrl = "/Content/Images/placeholder.gif" },
                new Lenses { Title = "Frequency 55 Toric Contact Lens", Brand = brands.Single(b => b.Name == "Cooper Vision"), Price = 10.99M, Manufacturer = manufacturer.Single(a => a.Name == "Alcon (CIBA Vision)"), LensManuUrl = "/Content/Images/placeholder.gif" },
                new Lenses { Title = "Freshkon N-Hance Toric", Brand = brands.Single(b => b.Name == "Fresh Kon"), Price = 11.99M, Manufacturer = manufacturer.Single(a => a.Name == "Oculus"), LensManuUrl = "/Content/Images/placeholder.gif" }
            }.ForEach(a => context.Lenses.Add(a));
        }
    }
}

I am also using EyeContactLensEntities.cs as a DbContext:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;

namespace EyeContactLens.Models
{
    public class EyeContactLensEntities : DbContext
    {
        public DbSet<Lenses> Lenses { get; set; }
        public DbSet<Brands> Brands { get; set; }
    }
}

web.config:

<connectionStrings>
    <add name="EyeContactLensEntities" connectionString="Data Source=|DataDirectory|EyeContactLens.sdf" providerName="System.Data.SqlClient"/>
</connectionStrings>

Global.asax.cs

protected void Application_Start()
{
    System.Data.Entity.Database.SetInitializer(new Models.SampleData());

    AreaRegistration.RegisterAllAreas();
    FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
    RouteConfig.RegisterRoutes(RouteTable.Routes);
    BundleConfig.RegisterBundles(BundleTable.Bundles);
}

i want to check if the date today equals the date in the access Data table but it says that you can't convert string to "system .data . data table" what should i do?

public void ToDay()
{
    DateTime dateTime = DateTime.UtcNow.Date;
     string d = (string)Session["gouser"];

    DataTable t;
    t="SELECT * FROM [ToDoList] where [UserID]='"
        + d + "' AND [D]='"
        + **dateTime.Date** + "'");
}

I've been able to secure my session cookies that I have created within my .NET web applications using this in the web.config file:

<httpCookies httpOnlyCookies="true" requireSSL="true"/>

However, aside from the ones I am making, there are apparently four other cookies being created in the session by Adobe Site Catalyst/Analytics plug ins in order to track user visits, determine browser compatibility with rich media and other performance category things. More information below:

s_ria: https://cookiepedia.co.uk/cookie/666901

s_ppv: https://cookiepedia.co.uk/cookie/666835

How can I also secure these cookies? When looking at my current session cookies through the Chrome debugger, I see mine with checks next to both "HTTP" and "Secure", however these other ones are not currently secure and I can't figure out how to achieve this. Any help would be greatly appreciated.

I am really struggling with javascript programming and need help.

I am trying to disable 6 drop down lists client side that are within a gridview. Below is my current javascript that works except for the last line where I am trying to disable one of the drop down lists. I believe the problem is because the drop down lists are in gridview and java cannot find them. How do I find them?

<script>
                        function EnableAndColorButtons() {
                            document.getElementById('<%= Submit.ClientID %>').disabled = false;
                            document.getElementById('<%= Submit.ClientID %>').style.background = "Lime";
                            document.getElementById('<%= Submit.ClientID %>').style.borderColor = "Green";
                            document.getElementById('<%= Cancel.ClientID %>').disabled = false;
                            document.getElementById('<%= Cancel.ClientID %>').style.background = "lightcoral";
                            document.getElementById('<%= Cancel.ClientID %>').style.borderColor = "Red";                                   
                            document.getElementById('<%= InfoLbl.ClientID %>').innerHTML = '(Continue to make changes or click submit if finished)';                                
                            document.getElementById('<%= MakeChangeslbl.ClientID %>').innerHTML = 'You must click "Submit Changes" or "Cancel Changes" above before making Assignment changes below!';
                            //The above is working, but the below is not probaly because the drop down lists are within gridview1
                            document.getElementById('<%= DropDownList1.ClientID %>').disabled = true;
                        }
                    </script>

My Gridview where the drop down lists are located looks like this:

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource3" DataTextField="FullDetails" DataValueField="FullDetails" Font-Size="Medium" Height="50px" OnDataBinding="DropDownlist1_DataBinding1" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" Width="230px">
                                            </asp:DropDownList>

I have a web form with multiple user controls, this form will show one user control at a time, each user control has it is own validation controls. but when I use Ajax (update panel) to show any of the user controls the validation not working.

I'm troubleshooting a bug that only shows in Safari where I get a console error saying: Reference Error: Can't find variable: ValidatorValidate. Chrome, Firefox and IE all work well.

I guess the method ValidatorValidate is part of the ASP .NET framework and its definition gets injected in the generated page. I'm not sure why it doesn't happen for Safari client.

I'm running ASP .NET Webforms from Visual Studio 2005. Any ideas will be highly appreciated.

I have an html table with three columns. The first and second column have a set width. It's GridViewClicks in the 3rd column that changes width dynamically.

When the webform first loads, the underlying datatable has 3 rows, which means that the gridview has 3 rows. Each column is set for a width of 200px. I set this in RowDataBound and it works great:

protected void GridViewClicks_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        DataRowView drv = e.Row.DataItem as DataRowView;

        for (int i = 0; i < drv.Row.ItemArray.Length; i++) //3 cols * # rows
        {
                e.Row.Cells[i].Width = 200;
        }
    }
}

Users begin using the webform, so this gridview begins growing since columns are added to the datatable.

In my particular case, my desktop screen can only display 5 columns and they're all 200px in width. But as soon as the 6th column is displayed, the gridview columns are squeezed in to fit in the available space of my screen. So naturally, the columns are not 200px wide. Let's say the gridview has 20 columns, then each column will be a fraction of the size. And this happens because it's trying to fit all 20 columns in the available space.

Instead of squeezing them in, I want to display a horizontal scrollbar. I tried using <div style="height: 800px; overflow: scroll;"> around GridViewClicks but it didn't do much.

Here's my markup:

<table style="border-collapse:collapse; height: 800px">
    <tr>
        <td style="padding-right: 30px; border:none; padding-left: 10px">
            <asp:ImageButton ID="ButtonBig" Width="278px" Height="284px" runat="server" />
        </td>
        <td style="vertical-align: top; padding-right: 20px">
            <asp:GridView ID="GridViewButtons" runat="server" ShowHeader="False" 
                onrowdatabound="GridViewButtons_RowDataBound" AutoGenerateColumns="false">
                <Columns>
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:ImageButton ID="ImageButtonDisplayPopup" runat="server" 
                            OnClick="ImageButtonDisplayPopup_Click" />
                    </ItemTemplate>
                </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </td>
        <td style="vertical-align: top">
            <asp:UpdatePanel runat="server">
            <ContentTemplate>
            <div style="height: 800px; overflow: scroll;">
                <asp:GridView ID="GridViewClicks" runat="server"  ShowHeader="False" 
                onrowdatabound="GridViewClicks_RowDataBound">
                </asp:GridView>
            </div>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
            </Triggers>
            </asp:UpdatePanel>
        </td>
    </tr>
</table>

This is an interesting problem I'm having. My controller is like

    public HomeController()
    {
        TaskRepo = new ArchiveTasksRepository();
    }

    // GET: /<controller>/
    public IActionResult Index()
    {
        return View();
    }

    [Route("tasks/all/count")]
    [HttpGet]
    [ResponseCache(Location = ResponseCacheLocation.None, NoStore = true)]
    public ActionResult NumberArchiveTasks()
    {
        return Json(TaskRepo.GetTaskCount());
    }

and I have a bunch of other endpoints like the NumberArchiveTasks one. This is for an ASP.NET Core app that I wrote following a tutorial. All the endpoints work when I run the app locally. But when I deploy to IIS on a remote server, the Index one works while the others don't; they 404. I'm not sure if it's the HttpGet attribute, the fact that I'm using ActionResult instead of IActionResult, or what exactly it could be. Maybe something else. Any idea how I could figure this out, or should I just guess-and-check until it works?

I'm trying to setup a slimline ASP.NET Core pipeline and am using AddMvcCore instead of AddMvc. I've copied this mostly from AddMvc, omitting the Razor related items:

public void ConfigureServices(IServiceCollection services) =>
    services
        .AddMvcCore(
            options => 
            {
                // JsonOutputFormatter not found in OutputFormatters!
                var jsonOutputFormatter = 
                    options.OutputFormatters.OfType<JsonOutputFormatter>.First();
                jsonOutputFormatter.SupportedMediaTypes.Add("application/ld+json");
            })
        .AddApiExplorer()
        .AddAuthorization()
        .AddFormatterMappings()
        .AddRazorViewEngine()
        .AddRazorPages()
        .AddCacheTagHelper()
        .AddDataAnnotations()
        .AddJsonFormatters()
        .AddCors();

I want to add a MIME type to the JsonOutputFormatter but it can't be found in the OutputFormatters collection. That said, the app can still output JSON, so I think the JsonOutputFormatter is being added at a later time.

I'm fairly new to programming so please be gentle. I'm trying to store the value of 'opponent' which is a Unique Identifier in tblOrders into opponentID Here's where I call it..

Dim opponentID As Guid = order.SelectOpponentID(orderID)

Below is the code I have tried but I get System.InvalidCastException: Specified cast is not valid. If anyone can please adjust this for me I would be so grateful..

VB CODE

Public Function SelectOpponentID(ByVal orderID As Guid)
    Dim DBConnect As New DBConn
    Using db As DbConnection = DBConnect.Conn("DBConnectionString")
        Dim cmd As SqlCommand = DBConnect.Command(db, "SelectOpponentID")

        cmd.Parameters.Add(New SqlParameter("orderID", SqlDbType.UniqueIdentifier, ParameterDirection.Input)).Value = orderID

        db.Open()
        Dim DR As SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        Dim opponentID As Guid
        While DR.Read
            opponentID = DR("opponent")
        End While
        DR.Close()
        DR = Nothing
        cmd.Dispose()
        cmd = Nothing
        db.Dispose()
        db.Close()
    End Using
End Function 

SQL CODE

ALTER PROCEDURE [dbo].[SelectOpponentID]
@orderID      uniqueidentifier
AS
BEGIN
    SET NOCOUNT ON;

    SELECT opponent
    FROM tblOrders
    WHERE orderID = @orderID
END

string email = System.Web.HttpContext.Current.Session["email"].ToString();

I am trying to do something like the code ab where i can retrieve the value stored inside of my session. I have already done string email = (string)(Session["email"]); on my aspx.cs files and it did return me the email stored in the session.

I am just now wondering how it can be done on class file.

public int countBasketItems()
{

    int counter = 0;

    String CS = System.Configuration.ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ConnectionString;
    using (SqlConnection con = new System.Data.SqlClient.SqlConnection(CS))
    {
        string email = HttpContext.Current.Session["email"].ToString();
        SqlCommand cmd = new SqlCommand("select Count(*) from basket where email = '" + email + "')", con);
        con.Open();
        counter = (int)cmd.ExecuteScalar();
    }
    return counter;

}

   <link href="Styles/calendar-blue.css" rel="Stylesheet" type="text/css" />
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.dynDateTime.min.js" type="text/javascript"></script>
<script src="Scripts/calendar-en.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#<%=TextBox1.ClientID %>").dynDateTime({
            showsTime: true,
            ifFormat: "%Y/%m/%d %H : %m",
            daFormat: "%l;%M %p, %e %m, %Y",
            align: "BR",
            electric: false,
            singleclick: false,
            displayarea: ".siblings('.dtcDisplayArea')",
            button: ".next()"
        });
    });
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
 <asp:Label ID="lblerrormsg" runat="server" Text="Error Message" Visible="False"></asp:Label>
<div>
<fieldset class="borrowing">
    <legend>Borrowing</legend>
    <asp:Label ID="Label5" runat="server" Text="Loan Date" Font-Bold=true></asp:Label>
    <br />
    <asp:TextBox ID="TextBox1" runat="server" Width="193px" Height="25px"></asp:TextBox>
    <img src="Images/Images/calender.png" />
         <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
    ControlToValidate="TextBox1" ErrorMessage="Loan Date Required"></asp:RequiredFieldValidator>--%>
    <br />
    <asp:Label ID="Label6" runat="server" Text="Due Date" Font-Bold=true></asp:Label>
    <br />
     <asp:TextBox ID="TextBox2" runat="server" Width="193px" Height="25px"></asp:TextBox>
    <img src="Images/Images/calender.png" />
      <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
    ControlToValidate="TextBox2" ErrorMessage="Due Date Required"></asp:RequiredFieldValidator>--%>
    <br />    

So this code I'm using is to get datepicker to work on ASP.Net. But the problem is if I want more than one textbox to contain a datepicker in one form it wont work. I've tried coping the code and changing Textbox1 to Textbox2 but no luck. How can I get two datepickers in the same form using this code?

I've built a web application. When I built it I ticked 'Organizational Accounts'

It works well - I log in with my Office 365 account and User.Identity.Name contains the email address

This application is a replacement front end for an older ASP Classic app. The App has an existing security table that I need to use.

I want to use the email address to look up a record in this table to get

  • The internal database key for the user (so I can use it in database calls)

  • The security level (authorisation) for the user

I want to look this up as soon as I am authenticated and save these two values to Session to refer to later

I have an existing method that does all of this lookup and caching. I actually got it working by calling it from the _LoginPartial.cshtml view but clearly it is incorrect to be triggering this kind of thing from a view

Here's the code to look up and cache user info. For now this is in AccountController.cs but it doesn't have to be

private Boolean GetAdditionalUserInfo()
{
    // if authentication info is saved, don't go find it
    if (Session["UID"] != null) return true;

    // get the db employee id from the database and save it to the session
    var r = (
            from e in db.Employees
            where e.Email == User.Identity.Name
            select new
            {
                e.Emp_ID,
                e.Group_ID
            }
            ).SingleOrDefault();

    if ((r == null) || (r.Group_ID == (int)Role.Inactive))
    {
        // couldn't find record or inactive
        return false;
    }

    // Update last login datetime
    Employee ell = db.Employees.Find(r.Emp_ID);
    ell.LastLogin = DateTime.Now;
    db.SaveChangesAsync();

    // Save user details to the session
    Session["UID"] = r.Emp_ID;
    // TBD: Investigate "CLAIMS" - this should probably be a claim
    Session["Role"] = r.Group_ID;

    return true;

}

I think the reference to User.Identity.Name triggers the login process so I could either just try and call this at startup (I don't know the correct way to do this), or I think the proper thing to do is to call this using the OnAuthentication method, and to link it up I should pass the name of my function to the OnAuthenticated property. Here's two links to the method and property:

https://msdn.microsoft.com/en-us/library/system.web.mvc.controller.onauthentication(v=vs.118).aspx

https://msdn.microsoft.com/en-us/library/microsoft.owin.security.microsoftaccount.microsoftaccountauthenticationprovider.onauthenticated(v=vs.113).aspx

But I have to say that OO programming is not my thing and I can't work out from these pages how to use them or which class to put them into.

This page implies it needs to go into Startup.Auth.cs but my Startup.Auth.cs looks nothing like that one. Here is most of my Startup.Auth.cs which was mostly autogenerated when I ticked 'organisational' at the start. (On a side note, app.UseKentorOwinCookieSaver(); is my next challenge because apparently organisational login doesn't work with Session can you believe it!!!)

Can anyone help me add required code to call GetAdditionalUserInfo()? after login? Or alternatively confirm that I can just call this at startup, and suggest the correct way to do it.

public partial class Startup
{
    private static string clientId = ConfigurationManager.AppSettings["ida:ClientId"];
    private static string aadInstance = ConfigurationManager.AppSettings["ida:AADInstance"];
    private static string tenantId = ConfigurationManager.AppSettings["ida:TenantId"];
    private static string postLogoutRedirectUri = ConfigurationManager.AppSettings["ida:PostLogoutRedirectUri"];
//private static string authority = aadInstance + tenantId;
// to make this multi tenant, use common endpoint, not the tenant specific endpoint
private static string authority = aadInstance + "common";

public void ConfigureAuth(IAppBuilder app)
{
    app.SetDefaultSignInAsAuthenticationType(
        CookieAuthenticationDefaults.AuthenticationType);

    // http://stackoverflow.com/questions/20737578/asp-net-sessionid-owin-cookies-do-not-send-to-browser
    app.UseKentorOwinCookieSaver();

    app.UseCookieAuthentication(
        new CookieAuthenticationOptions());

    app.UseOpenIdConnectAuthentication(
        new OpenIdConnectAuthenticationOptions
        {
            ClientId = clientId,
            Authority = authority,
            PostLogoutRedirectUri = postLogoutRedirectUri,
            TokenValidationParameters = new TokenValidationParameters
            {
                // If you don't add this, you get IDX10205
                // from here http://charliedigital.com/2015/03/14/adding-support-for-azure-ad-login-o365-to-mvc-apps/
                ValidateIssuer = false                        
            },
            Notifications = new OpenIdConnectAuthenticationNotifications
            {
                RedirectToIdentityProvider = ctx =>
                {
                    bool isAjaxRequest = (ctx.Request.Headers != null && ctx.Request.Headers["X-Requested-With"] == "XMLHttpRequest");

                    if (isAjaxRequest)
                    {
                        ctx.Response.Headers.Remove("Set-Cookie");
                        ctx.State = NotificationResultState.HandledResponse;
                    }

                    return System.Threading.Tasks.Task.FromResult(0);
                }
            }
        });
   }
}

@if (str_item != "" && str_checkroles != "" && str_item == str_checkroles) {

<script> 
src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>

                            <script type="text/javascript">
                                   $(function () {
                                     $('#@(item.Text)').attr('checked', true);

                                        $('#dummychk').prop('checked', true);
                                });
                        </script>
                       
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>

I have an ASP.Net Core MVC with razor views that uses VueJs2 when it needs to be more complex.

I want to have a js file per view.

My folder structure is like that:

├ Controllers\HomeController.cs (with actions Index & Details)
├ Scripts\Home\index.ts
├ Scripts\Home\details.ts
├ Views\Home\Index.cshtml
├ Views\Home\Details.csthml
├ wwwroot\lib\vue
├ wwwroot\js\Home\index.js (generated with typescript)
├ wwwroot\js\Home\details.js (generated with typescript)
├ tsconfig.json

Here is my tsconfig.json

{
  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5",
    "outDir": "wwwroot/js",
    "rootDir": "Scripts",
    "allowSyntheticDefaultImports": true,
    "lib": [
      "dom",
      "es5",
      "es2015.promise"
    ]
  },
  "include": [
    "wwwroot/lib/vue/typings",
    "Scripts"
  ],
  "compileOnSave": true
}

My index.ts file

import Vue from 'vue'

var app = new Vue({
    el: '#app',
    data: {
        message: 'Hello Vue!'
    }
})

And the generated file:

"use strict";
var vue_1 = require("vue");
var app = new vue_1.default({
    el: '#app',
    data: {
        message: 'Hello Vue!'
    }
});
//# sourceMappingURL=index.js.map

In my Index.cshtml I load the js file but I have this require instruction that is not working in my browsers.

How to have this js files working within a browser?