suppose i am developing a site with ASP.Net MVC core. i have created a empty project where i add two controller.
one is Home and login controller. Home controller's index action is not protected by Authorized attribute but Home controller's product action is protected.
when user try to access product action then user should be redirected to login page if not signed in. so tell me how to setup project in classic mvc or mvc core where i will mention that user should be redirected to login page if user is not signed in.
i will not use identity rather i will check user credentials from db using ado.net.
please guide me step wise that what i need to follow. Thanks
Sir, my question was bit different. i am trying to know how asp.net mvc engine understand now user need to redirect to login page? if login controller name would be different then how asp.net mvc understand it ? where this binding done in default project when we create a default project from IDE?
i believe there must be a place where we mention that login page should come if user is not signed in when access any protected resource.
When the form is submitted, all buttons on that form will have their disabled property set to false. But that won't actually accomplish anything; a button's name and value are only submitted with the form if you click on that button, and you can't click on a disabled button.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Quick intro, My name is Jason and recently a work colleague retired and had developed several ASPX websites of which I have been tasked to support.
My previous background of programming is around Delphi, Intersystems Cache and more recently C# but these websites that I'm now supporting are all written in VB.net, asp.net, aspx or whatever language it is called, as you have probably guessed by now I have never used Visual Studio or produced code that created aspx files.
Anyway as a newbie to this language I have run into a problem that you experts will have learnt in school
I have a webpage (student.aspx) that contains this snippet of code :
The OnChange event will run on the server, when the page posts back to the server. That normally only happens when you click a button; if you want it to happen as soon as your list changes, you'll need to set the AutoPostBack property of the list to True.
SELECT DISTINCT does not work the way I want.
SELECT DISTINCT works for the class column but not for name_event column
If "MyId"is e.g. CW and there are 4 lines there but name_event should only be 2 pcs, but it shows 4 pcs
It should be:
What am I doing wrong?
<pre> Dim MyDataAdapter AsNew SqlDataAdapter("SELECT DISTINCT class, nationality, name_event from statistics_results Where class = @class", MyConnection)
MyDataAdapter.SelectCommand.Parameters.Add(New SqlParameter("@class", SqlDbType.VarChar, 10))
MyDataAdapter.SelectCommand.Parameters("@class").Value = MyId
TryDim dt AsNew DataTable()
Dim natlist = dt.AsEnumerable().[Select](Function(r) r("nationality").ToString())
Dim natvalue AsString = String.Join("- ", natlist)
litNat.Text = natvalue
Dim eventlist = dt.AsEnumerable().[Select](Function(r) r("name_event").ToString())
Dim eventvalue AsString = String.Join("<br>", eventlist)
litEvent.Text = eventvalue
Catch exc As SqlException
Sorry I missed the data source, yes I use MS SQL server. Have tried the variants above but I get the wrong number of "name_event"
I get numbers according to how many rows there are in the selected class.
This is how it will be at a selected class. It should be 1 World Championships note 6
Tips on how to solve it?
DEU - FIN - FRA - NOR - POL - SWE
Having trouble importing competition results from Excel to MS SQL Server with Asp.Net. Worked well until I added milliseconds. They are lost on import. Anyone with good tips on what the problem is?
MS SQL server Data Type: time(7)
Excel formatting for time results (Swedish Excel): tt:mm:ss,0
MyCommand.Parameters.Add(New SqlParameter("@total", SqlDbType.Time, 7))
MyCommand.Parameters("@total").Value = Trim(rad("Total"))
Time in Excel: 00:26:32,4
In SQL server: 00:26:32
I lost the milliseconds.
where in the lifecycle of an asp.net page do you load the data for a gridview?
In Page_Load (which runs twice and check on !IsPostback is needed), in Page_LoadComplete (runs once) or in Page_Prerender (runs once)
I see better/smoother working of the pages when loading in Page_Loadcomplete event. How are your experiences?
I use Page_Prerender to set properties of a GridView other than DataSource and DataBind.
In Word you can only store 2 bytes. That is why I use Writer.
Last Visit: 31-Dec-99 18:00 Last Update: 12-Aug-22 6:15