|
Every request to your application is handled by an instance of a class which implements the IHttpHandler interface[^].
For a WebForms page (.aspx ), that class will be derived from the System.Web.UI.Page class[^]. Session state is controlled by setting the EnableSessionState attribute on the @ Page directive[^]. It can be set to "True", "False", or "ReadOnly". The compiler will automatically implement the correct session state interface on the generated class for you.
For other handlers, session state is enabled or disabled depending on whether the handler class implements the IRequiresSessionState interface[^], or the IReadOnlySessionState interface[^] if it doesn't add or update any session data.
Implementing the IRequiresSessionState interface in a class which is not the handler for the current request will have no effect.
ASP.NET Session State Overview | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you for brief explanation.
|
|
|
|
|
what is major difference between blazor server app and asp.net mvc razor app?
=====================================================
The grass is always greener on the other side of the fence
|
|
|
|
|
|
every interaction is a network call
if i have slow internet then basic functions will take forever to execute
=====================================================
The grass is always greener on the other side of the fence
|
|
|
|
|
My take on it was that with Blazer, you can make client side apps sort of like Angular, in which you can type your client side code in c# instead of JavaScript or TypeScript, and a Blazer utility sort of like Babel will translate your c# code into current and backwards compatible JavaScript, and automatically insert it into the server side generated HTML, and transmit it back to the client.
This reminds of .Net MVC, in which you can add React client and server via NuGet packages, and write react modules to insert on Razor pages, in which Babel will translate the React module into JavaScript and integrate into the server generated HTML and send the page to the client. So instead of client generating React JavaScript, it's done on the server side, so that .Net can keep track of it.
Babel is a translator, that can generate backwards compatible JavaScript from ECMAScript 2015+
What is Babel? · Babel
So in my mind from what I read of it, Blazer is sort of like ReactJS using Babel, or AngularJS in which you can create a single page application SPA within a single Razor page all in c# without the steep learning curve of ReactJS or AngularJS.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I have a GridView with template fields and one of the template field is a dropdownlist which is dynamically added into the gridview control. It's working properly on page load when I click the button control to the get the values from the template fields it will throw a null reference exception. Please correct my error, I am in pathetic situation. I attached the source code.
Regards
rites|Alert Moderators
asolmduasolmdu
None
0 Points
1 Post
gridview with dynamic dropdownlist control null exception
33 minutes ago|LINK|157.50.247.59
I have a GridView with template fields and one of the template field is a dropdownlist which is dynamically added into the gridview control. It's working properly on page load when I click the button control to the get the values from the template fields it will throw a null reference exception. Please correct my error, I am in pathetic situation. I attached the source code.
Regards
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"
OnRowCreated="GridView1_RowCreated">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="id" runat="server" Text='<%# Eval("RGNO") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="name" runat="server" Text='<%# Eval("NAME") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="lastname" runat="server" Text='<%# Eval("DOB") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
BindGridView();
}
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DropDownList ddlResult = new DropDownList();
ddlResult.ID = "ddlResult";
ddlResult.Items.Insert(0, new ListItem("PASS", "0"));
ddlResult.Items.Insert(1, new ListItem("FAIL", "1"));
PlaceHolder p = (PlaceHolder)e.Row.FindControl("PlaceHolder1");
p.Controls.Add(ddlResult);
}
}
private void BindGridView()
{
GridView1.DataSource = CreateDataSource();
GridView1.DataBind();
}
public DataTable CreateDataSource()
{
DataTable dt = new DataTable();
DataRow dr;
dt.Columns.Add(new DataColumn("RGNO", typeof(string)));
dt.Columns.Add(new DataColumn("NAME", typeof(string)));
dt.Columns.Add(new DataColumn("DOB", typeof(string)));
dr = dt.NewRow();
dr["RGNO"] = "1001";
dr["NAME"] = "PRAKASH";
dr["DOB"] = "10-10-2003";
dt.Rows.Add(dr);
return dt;
}
protected void Button1_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
DropDownList dd1 = (DropDownList)row.FindControl("ddlResult");
Response.Write(dd1.SelectedItem.Text);
}
}
|
|
|
|
|
i want to add video calling "one to one and one to many" function on my web page using asp.net bt i dont understand how i can add this on my web site
|
|
|
|
|
You can either buy something that supports what you want to do, or spend years writing millions of lines of code spanning many different technologies to achieve this.
|
|
|
|
|
|
This my aspx code
<table align="center">
<tr valign="top">
<td>
<asp:DataList ID="gv1" runat="server" RepeatColumns="1" RepeatDirection="Horizontal">
<HeaderTemplate>
Our Tutors List</HeaderTemplate>
<ItemTemplate>
<table width="600px" border="2" align="center">
<tr align="center">
<td width="100%" valign="top" style="font-size: 15px">
Name: <%#DataBinder.Eval(Container.DataItem, "FirstName")%> <%#DataBinder.Eval(Container.DataItem, "LastName")%>
<%--Mobile: <%#DataBinder.Eval(Container.DataItem, "MobileNo")%>
Email Id: <%#DataBinder.Eval(Container.DataItem, "EmailId")%> --%>
</td>
</tr>
<tr>
<td>
Qualification: <%#DataBinder.Eval(Container.DataItem, "Qualification")%>
Experience: <%#DataBinder.Eval(Container.DataItem, "Experience")%>
</td>
</tr>
<tr>
<td>
Subjects:
<%#DataBinder.Eval(Container.DataItem, "Subjects")%>
<%--Created Date: <%#DataBinder.Eval(Container.DataItem, "CreatedDate")%>--%>
</td>
</tr>
<tr>
<td>
Locations:
<%#DataBinder.Eval(Container.DataItem, "Location")%>
</td>
</tr>
<tr>
<td>
Description:
<%#DataBinder.Eval(Container.DataItem, "Description")%>
</td>
</tr>
</table><br /><br />
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:DataList>
<table width="100%" border="0">
<tr bgcolor="" align="center">
<td>
<asp:LinkButton ID="lnkbtnPrevious" runat="server" Text="<" OnClick="lnkbtnPrevious_Click"></asp:LinkButton>
</td>
<td>
<asp:DataList ID="dlPaging" runat="server" RepeatDirection="Horizontal" OnItemDataBound="dlPaging_ItemDataBound"
OnItemCommand="dlPaging_ItemCommand" OnSelectedIndexChanged="dlPaging_SelectedIndexChanged"
UseAccessibleHeader="True">
<ItemTemplate>
<asp:LinkButton ID="lnkbtnPaging" runat="server" CommandArgument='<%#Eval("PageIndex")%>'
CommandName="lnkbtnPaging" Text='<%#Eval("PageText")%>'></asp:LinkButton>
</ItemTemplate>
</asp:DataList>
</td>
<td>
<asp:LinkButton ID="lnkbtnNext" runat="server" Text=">" OnClick="lnkbtnNext_Click"></asp:LinkButton>
</td>
</tr>
</table>
</td>
</tr>
</table>
<aspx.cs code="">
using System;
using System.Data;
using System.Web.UI.WebControls;
public partial class MathsTutors : System.Web.UI.Page
{
PagedDataSource pds = new PagedDataSource();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}
private void BindData()
{
ClsTutorDetails tutor = new ClsTutorDetails();
DataTable dt = tutor.GetAllTutors("Active");
pds.DataSource = dt.DefaultView;
pds.AllowPaging = true;
pds.PageSize = 12;
pds.CurrentPageIndex = CurrentPage;
lnkbtnNext.Enabled = !pds.IsLastPage;
lnkbtnPrevious.Enabled = !pds.IsFirstPage;
gv1.DataSource = pds;
gv1.DataBind();
if (dt.Rows.Count <= 12)
{
dlPaging.Visible = false;
lnkbtnNext.Visible = false;
lnkbtnPrevious.Visible = false;
}
else
{
dlPaging.Visible = true;
lnkbtnNext.Visible = true;
lnkbtnPrevious.Visible = true;
}
doPaging();
}
#region
private void doPaging()
{
DataTable dt = new DataTable();
dt.Columns.Add("PageIndex");
dt.Columns.Add("PageText");
for (int i = 0; i < pds.PageCount; i++)
{
DataRow dr = dt.NewRow();
dr[0] = i;
dr[1] = i + 1;
dt.Rows.Add(dr);
}
dlPaging.DataSource = dt;
dlPaging.DataBind();
}
public int CurrentPage
{
get
{
if (this.ViewState["CurrentPage"] == null)
return 0;
else
return Convert.ToInt16(this.ViewState["CurrentPage"].ToString());
}
set
{
this.ViewState["CurrentPage"] = value;
}
}
protected void lnkbtnPrevious_Click(object sender, EventArgs e)
{
CurrentPage -= 1;
BindData();
}
protected void lnkbtnNext_Click(object sender, EventArgs e)
{
CurrentPage += 1;
BindData();
}
protected void dlPaging_SelectedIndexChanged(object sender, EventArgs e)
{
CurrentPage = 0;
BindData();
}
protected void dlPaging_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName.Equals("lnkbtnPaging"))
{
CurrentPage = Convert.ToInt16(e.CommandArgument.ToString());
BindData();
}
}
protected void dlPaging_ItemDataBound(object sender, DataListItemEventArgs e)
{
LinkButton lnkbtnPage = (LinkButton)e.Item.FindControl("lnkbtnPaging");
if (lnkbtnPage.CommandArgument.ToString() == CurrentPage.ToString())
{
lnkbtnPage.Enabled = false;
lnkbtnPage.Font.Bold = true;
}
}
#endregion
}
|
|
|
|
|
|
Using VS2019 with Core 3 I am attempting to secure a web project. Web API does the validation and returns a JWT token with the user authorisation details, role only. Tihs works fine as the JWT decodes with all the correct info in it.
My problem is to get that information into MS Identity (or have I got it completely wrong).
I am NOT using EntityFrameworkCore just to service the user validation.
My login partial has the following.
@if (User.Identity.IsAuthenticated)
{
<form asp-controller="Account" asp-action="Logout" method="post" id="logoutForm">
<ul>
<li>
<button type="submit">Log out</button>
</li>
</ul>
</form>
}
else
{
<ul>
<li><a asp-page="/Login">Log in</a></li>
</ul>
}
The .cs code
public async Task<IActionResult> OnPostAsync(string returnUrl = null)
{
CSDUtil.PWDUtil oUtil = new CSDUtil.PWDUtil();
try
{
ReturnUrl = returnUrl;
if (ModelState.IsValid)
{
UserDetailsDB data = UserDetails;
UserDetailsDB oUser = await dsUserDetails.AutenticateAsync(data);
if (oUser == null)
{
ModelState.AddModelError(string.Empty, "Invalid user details.");
return Page();
}
JwtSecurityTokenHandler oHandler = new JwtSecurityTokenHandler();
var key = Code.MainUI.Key;
var handler = new JwtSecurityTokenHandler();
var jwtToken = new JwtSecurityToken(oUser.Token);
var validations = new TokenValidationParameters
{
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(key),
ValidateIssuer = false,
ValidateAudience = false
};
ClaimsPrincipal oPrincipal = handler.ValidateToken(oUser.Token, validations, out SecurityToken oToken);
int i = oPrincipal.Claims.Count();
var authProperties = new AuthenticationProperties
{
AllowRefresh = true,
ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(60),
IsPersistent = true,
IssuedUtc = DateTimeOffset.Now,
RedirectUri = "/Index"
};
await HttpContext.SignInAsync(
CookieAuthenticationDefaults.AuthenticationScheme,
new ClaimsPrincipal(oPrincipal),
authProperties);
var B = User.Identity.IsAuthenticated;
return LocalRedirect(Url.GetLocalUrl(returnUrl));
}
}
The ClaimsPricipal populates correctly with the details of the user in identities[0] of that collection.
How do I move the user details from the ClaimsPrincipal to the User.Identity?
[Edit]
I have the claims added to User.Identity but IsAuthenticated is still false
ClaimsPrincipal oPrincipal = handler.ValidateToken(oUser.Token, validations, out SecurityToken oToken);
returnUrl = "/Index";
ClaimsIdentity identity = User.Identity as ClaimsIdentity;
foreach (Claim oClaim in oPrincipal.Claims)
{
identity.AddClaim(oClaim);
}
var B = User.Identity.IsAuthenticated;
return LocalRedirect(Url.GetLocalUrl(returnUrl));
[/Edit]
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
modified 28-Oct-19 19:42pm.
|
|
|
|
|
I'm probably way off on this one. I haven't worked on this subject in over 3 years and I was using MVC, not .Net Core 3.0.
I understand the JWT Token and how it works, but thought that was for frameworks like Angular, React, Vue, where you just write the token in a cookie or Local Storage. I use JWT currently and can do OAuth2 with Google in my Angular project.
To the best of my knowledge, and I did a lot of research on this subject because I didn't want to use Microsoft Identity and get wrapped up in it's complex authentication methods. But the way I understood Microsoft.Identity was that under the hood, it took care of a lot of stuff in the background. Stuff like OAuth2 into Google, Facebook for alternative methods of sign in credentials other than the typical ones we make. But I'm not clear on it's life cycle and how it reloads Identity on every page cycle.
So I used GenericIdentity from System.Security.Principals. I could create a new Identity, store all the stuff I need in it, and it would trickle down to the Controller, View and Razor. But the caveat was that it had a short lifespan of 1 page cycle. So my code had to be wrapped in a custom controller attribute on each page I wanted to be secure.
So the user logs in, you generate the JWT token, create a fresh Identity, and then when you redirect to the next page and the Identity is blank and authenticated is false.
Code sample to clarify my work around:
Controller action with my AdminSecurityCheck attribute
[HttpGet]
[AdminSecurityCheck]
[Route("{userName}/Messages/{page?}/{id?}/{q?}/{s?}")]
public IActionResult Messages(int? page, int? id, string q, int? s)
Simple Attribute Code
[AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
public class AdminCheckAttribute : ActionFilterAttribute, IActionFilter
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
var controller = filterContext.Controller as Controller;
var httpContext = controller.HttpContext;
Model_Admin_Login pResult = SecurityCookies.CookieRead_Admin_Login(httpContext);
if (pResult.AccountName != null)
{<br />
Model_Admin_Login model = new Model_Admin_Login();
bool result = EF_Website_Users.AdminCheck_AccountName(pResult.AccountName, ref model);
if (result)
{
String[] newRoles = { "Administrator" };
GenericIdentity newIdentity = new GenericIdentity(pResult.AccountName);
GenericPrincipal newPrincipal = new GenericPrincipal(newIdentity, newRoles);
httpContext.User = newPrincipal;
System.Threading.Thread.CurrentPrincipal = httpContext.User;
controller.ViewData["Admin_Menu"] = true;
controller.ViewData["Admin_UserID"] = model.ID;
controller.ViewData["Admin_UserName"] = pResult.AccountName.ToLower();
controller.ViewData["Admin_ImageUrl"] = model.Avatar.Url;
controller.ViewData["Admin_ImageAlt"] = model.Avatar.Alt;
controller.ViewData["Admin_Base64"] = model.Avatar.Data != null ? Convert.ToBase64String(model.Avatar.Data, 0, model.Avatar.Data.Length) : null;
}
else
{
controller.ViewData["Admin_Menu"] = false;
}<br />
}
else
{
controller.ViewData["Admin_Menu"] = false;<br />
}
base.OnActionExecuting(filterContext);
}
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Now that feels like a hack
Does JWT not allow you to recycle the credentials via the server by passing them back and forth in the token?
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
JWT just generates a unique token, that contains information about the user, and some other parameters such as length of authorized time, and expiration date. So with a token, you can store it in the browsers Local Storage using JavaScript and read it back it using JavaScript. With JavaScript you can get info out of the token, or check to see if the token is expired, and then refresh it or issue a new one.
In Angular, you pickup the token, and pass the token in the header sent to the .Net Core V2.2+ API.
headers: new HttpHeaders({
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer " + tokenGetter
})
And then the API will run a service or something called Authorize.
[HttpGet("GetAdminBrands/{page}/{show}"), Authorize]
public async Task<GetBrands> GetAdminBrands(int page, int show)
{
var brand = await _brandsRepository.GetBrands(page, show);
return brand;
}
You set this up in Startup
services.AddAuthorization(auth =>
{
auth.AddPolicy("Bearer", new AuthorizationPolicyBuilder()
.AddAuthenticationSchemes(JwtBearerDefaults.AuthenticationScheme)
.RequireAuthenticatedUser().Build());
});
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
var settings = Configuration.GetSection("Settings");
var secretKey = settings.GetValue<string>("Auth0:Secret");
var signingKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(secretKey));
var authority = settings.GetValue<string>("Auth0:Authority");
var audience = settings.GetValue<string>("Auth0:Audience");
options.RequireHttpsMetadata = false;
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuerSigningKey = true,
ValidateIssuer = true,
ValidateAudience = true,
ValidateLifetime = true,
ValidIssuer = authority,
ValidAudience = audience,
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(secretKey))
};
});
So above is what I'm using now, which is Angular wrapped in .Net Core V2.2+
The code I posted earlier was a work around or hack to avoid using Microsoft.Identity in it's full scale, since I just wanted a partial portion of it. What I mean by full scale was having to use such a large chunk of controllers, models and views in which no explanation was really provided in how it works and why. Microsoft.Identity was take it or leave it with nothing in between. That prompted me to do some reverse engineering of it to see how it worked, and hack something else together that was more light weight.
When I think about it now, JWT pretty much works the same way as my hack does. But there's a large JavaScript client side library to support it, and is not all server side.
I did post questions about my hack 3 years ago and nobody bashed it. But I did hear crickets about it as to nobody here posted a single comment about it.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Hi,
The Data I Write on the Textbox is Inserted into the Table with the Insert Button
https://i.hizliresim.com/4pnb8Q.jpg[^]
When the Complete Button is Triggered, I Need to Import All Rows on the DataTable into the List I Created
How can I do this?
My Source Code is as follows
<%@ Page Title="" Language="C#" MasterPageFile="~/TemsilciIslemleri.Master" AutoEventWireup="true" CodeBehind="TemsilciSiparisIslemleri.aspx.cs" Inherits="BilgiYonetimSistemi.TemsilciSiparisIslemleri" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="container-fluid px-xl-5">
<section class="py-5">
<div class="row">
<div class="col-lg-12 mb-4">
<div class="card">
<div class="card-header">
<h6 class="text-uppercase mb-0">Satış Temsilci Sipariş İşlemleri</h6>
</div>
<div class="card-body">
<div style="overflow-x: auto;">
<table id="SatisTemsilcisiSiparisListesi" class="table table-striped card-text">
<div>
<asp:TextBox ID="TextBox1" runat="server" CssClass="form-control"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox2" runat="server" CssClass="form-control"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox3" runat="server" CssClass="form-control"></asp:TextBox>
<br />
<asp:Button ID="BTNSatisIslemleri" runat="server" CssClass="btn btn-primary shadow px-5 shadow form-control-range" Text="Ekle" OnClick="BTNSatisIslemleri_Click" OnClientClick="return false" />
<br />
<br />
</div>
<thead>
<tr>
<th scope="col">Name and Surname</th>
<th scope="col">Age</th>
<th scope="col">Country</th>
</tr>
</thead>
</table>
<br />
<asp:Button ID="BTNIslemTamamla" runat="server" CssClass="btn btn-primary shadow px-5 shadow form-control-range" Text="Tamamla" OnClientClick="return false"/>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<script>
$('#ContentPlaceHolder1_BTNSatisIslemleri').click(function () {
var table = $('#SatisTemsilcisiSiparisListesi').DataTable();
var rowNode = table
.row.add([$('#ContentPlaceHolder1_TextBox1').val(), $('#ContentPlaceHolder1_TextBox2').val(), $('#ContentPlaceHolder1_TextBox3').val()])
.draw()
.node();
$(rowNode)
.css('color', 'black')
.animate({ color: 'black' });
});
$(document).ready(function () {
$('#SatisTemsilcisiSiparisListesi').DataTable({
"order": [[2, "asc"]],
dom: 'Bfrtip',
buttons: ['copy', 'csv', 'excel', 'pdf', 'print']
});
});
</script>
</asp:Content>
|
|
|
|
|
Hi everybody,,
I'v installed ASP maker app to assist me in generating Web forms from database very fast .. but the problem is that it uses visual Basic as a code behind for asp pages.. does anyone know how can I make it use C#??
with VB it's unusable because can't modify the code ..
and please tell me about other useful applications..
the link of the app
ASPMaker 2018 - The Best ASP Code Generator[^]
|
|
|
|
|
You should ask this question at the ASPMaker forums.
|
|
|
|
|
Hi,
I need to draw triangle into canvas. When I research this on web, I found that we can draw shapes into canvas by using javascript, like below.
$(function () {
var canvas = document.getElementById('mycanvas');
var context = canvas.getContext('2d');
context.fillRect(30, 30, 70, 90);
});
But the problem is, when a button clicked, I need to generate shape on server side than return it back to canvas as I callback result.
Can give me an idea about it?
Thank you
|
|
|
|
|
Quote: I need to generate shape on server side than return it back to canvas as I callback result.
Then that means that you process and return the result from the server, and have the client-side JavaScript render it. One of the way we can do that would be to remove the hardcoded values,
context.fillRect(30, 30, 70, 90); Becomes,
let points = [ 30, 30, 70, 90 ];
context.fillRect(points[0], points[1], points[2], points[3]); That is definitely one of the ways in which this can be done. Once you reach this point, you can see that this same array can be returned from a server. You can use jQuery's Ajax and request the content from the server,
$.ajax({
url: '/points-generator',
success: function(data) {
context.fillRect(data[0], data[1], data[2], data[3]);
}
}); This assumes that you change your context variable to be a global variable so that it can be accessed from almost every function. Then, you can request the data from server using Ajax, and then render the data.
Read more on the MDN documentation for context and study the parameter-lists, and then generate the proper responses for your requests.
CanvasRenderingContext2D - Web APIs | MDN
jQuery.ajax() | jQuery API Documentation
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Thanks all for the answers.
I generated objects (points) in controller class and returned points back from server.
I have a question drawing right angle triangle.
I generated a and b sides and calculated hypotenuse. But using canvas, I draw a and b sides and use closePath() function to draw line from a to b. Looks like hypotenuse value is useless. How can I draw hypotenuse without closePath() function?
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.moveTo(20, 20);
ctx.lineTo(20, response.sideB);
ctx.lineTo(response.sideA, response.sideB);
ctx.closePath();
|
|
|
|
|
As far as I know, when you want to draw an object and place them on a canvas to save as an image, you use System.Drawing on the server side.
When you want to draw a shape directly on a web page, you can use CSS to draw and animate.
You can also use the canvas web API to draw shapes as well.
So search for System.Drawing, Draw Triangle.
There are hundreds of examples available online.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Hello, in my details view model I want to make a LINQ that shows 4 related car to the current car by manufacturer and price, but I don't get it to work really, can someone please helpme? The view model looks like this.
public class DetailsViewModel
{
public BolindersContext ctx;
public Car car;
public Car currentCar;
public DetailsViewModel(BolindersContext ctx)
{
this.ctx = ctx;
}
public DetailsViewModel(BolindersContext ctx, Car car)
{
this.ctx = ctx;
this.car = car;
this.currentCar = car;
}
IQueryable<Car> PriceyCars(BolindersContext ctx, Car currentCar)
{
return ctx.Cars.Where(e => e.Brand == car.Brand).Where(e => e.Price > car.Price).OrderBy(e => e.Price).Take(4);
}
|
|
|
|
|
I would imagine that you just need to change car to currentCar
IQueryable<Car> PriceyCars(BolindersContext ctx, Car currentCar)
{
return ctx.Cars.Where(e => e.Brand == currentCar.Brand).Where(e => e.Price > currentCar.Price).OrderBy(e => e.Price).Take(4);
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|