Link to home
Start Free TrialLog in
Avatar of sirbounty
sirbountyFlag for United States of America

asked on

Beginning a new project (first question of a series)

I'm looking for a bit of hand-holding on setting up, what I thought would be a simple project.
I am using Visual Studio 2017 .Net 4.7.
I've done some coding in c# long ago, but am more comfortable in vb.net.
I had previously done quite a bit of winform development, and only ever dabbled in web dev.  Since it's been so incredibly long ago, I would like to have some guidance on starting this from scratch.

I plan to have multiple progression questions on this and I'll attempt to keep it limited to simple steps throughout.
For the first question on this, however, I need to describe what I'm envisioning:

I will have a user visit this single web page. There would be a title with a button/link to click for more info (detailed instructions located elsewhere in our intranet).
Page load would read a sql database to pull down a list of memberships for this specific user (I do have the working code to accomplish this).
Those results are then placed into a list box (I thought a checkedlistbox would be best).  

The user is then given the following options:
A button, always available, to CREATE.
A button, only available if one, and only one item is selected, to MODIFY.
A button only available if one or more items are selected.  This button should present a confirmation, since this would be a delete process to occur.

I'd like to use bootstrap because I did spend a bit of time learning a bit about it, but I have very little knowledge on how to implement it into my code.

So - for this first question...  What the heck do I choose for starting this project? :^)
If I click File/New Web site (not project, presumably), I'm given options for
ASP.Net Empty Web Site, ASP.NET Web Forms Site, ASP.NET Web Site (Razor v3), ASP.NET Dynamic Data Entries Web Site or WCF Service.
Avatar of Ron Malmstead
Ron Malmstead
Flag of United States of America image

Sounds pretty basic, but you should first decide on your authentication method, users/permissions management, and think about what level of security is needed overall.  Do you need SSL for example (sensitive data)?  Is it going to face the internet or just internal?  And how many users in the future may use it?

You can start with either Empty Web Site and add default.aspx with a redirect to the actual default page you want....or choose Web Forms Site which gives you a default template..(not much difference save for a few folders and a default page).

From there, if you right click your page in the project explorer and "view code"... it will take you to the backend code for the page. (home.aspx.vb for example.)  Or if you view it in design mode and double click anywhere on the page in design view...it will automatically create the Page_Load sub.  You can also drop a button control on the form, name it.. .btn_Create, then double click it and it will also create a default onclick event for the button... other controls do similar things when double clicked.

In the Page_Load sub, which fires every time the page is requested, I typically start with security statements.  I like to use Session with basic auth, it's my preference... you can also use integrated auth if you have a domain, or single sign on, and other methods.

Security statement example...
If Session("UserLoggedIn") = True Then
'The user has authenticated
Else
'The user is not authenticated
Response.Write("You are not authorized to view this page.")
Exit Sub
End If

Open in new window


You can also add statements to restrict the subnet, or check if an internal process (server) is accessing a service rather than a user/computer.

, Next I typically have an IF statement ....

If Page.IsPostBack Then
'Code for when page is posted back with data
'Process the request to save/modify/delete data
        Else
'Code for when the page is loaded the first time.
'Initialize forms/load default data
 End If

Open in new window


Your mileage may vary, and this is just a basic example of how I usually start when making a simple web app for internal use.
I would be more than happy to help you with the code when you run into roadblocks.

For responsiveness though, you should use Javascript and JQuery, for the front end form controls behaviour...this way the page doesn't have to post back every time the user does something to the form, and you don't have to mess with Update Panels to prevent page refreshes.

One more thing... ALWAYS use parameterized SQL statements, to avoid SQL injection attacks.
Avatar of sirbounty

ASKER

Authentication...
Well, I think that would be handled by my underlying app.  This is simply a front end that would create a process file.
If the requester isn't an owner, it will get denied there.  No internet access, no SSL needed.
Upwards of 50k users could potentially use it.

"You can start with either Empty Web Site and add default.aspx with a redirect to the actual default page you want...."
What's the benefit of that?
Web forms seemed to load me up with folders and files I'll likely never use?

I've also used javascript many moons ago.  Would need to brush off the dust, but I don't mind heading in that direction if there are benefits such as described.

I'm using a sproc for my sql call.

Thanks for the information.
Hi SirBounty,

Ideally (I write ideally as it will end up rendering your existing code useless), go with ASP.NET Web Site (Razor v3),

It will start an ASP.Net MVC project with basics in place. From there, we can start your journey towards MVC + Entity Framework based site.

PS: Why not use .Net Core?
PPS: How important this web site is for your organization/ yourself?

Regards,
Chinmay.
I just started exploring some of the Razor stuff, but I started over from scratch using a blank web site in visual studio code.  I have the 'look' of what I'm after, but need to gather how to read from the database and populate dynamic rows (all in good time).

Not familiar at all with MVC, nor .Net core.
This will ultimately be a pretty important, internal, web site.  It's currently an automated solution provided via email.  This is merely a front-end/alternate model for that underlying process.  That process works off of properly formatted text files that are ingested into a powershell application.
ASKER CERTIFIED SOLUTION
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm intrigued - can you give me some more info on why you think the advantages are so significant?
:P... Aahh my favorite kind of question.. I can go on n on n on :P... but I am too lazy.. .check it... really exhausted...  right now.. I was about to suggest you to read the link I posted above.. but... well I can just dump it... right here.


Why choose ASP.NET Core?
Millions of developers have used (and continue to use) ASP.NET 4.x to create web apps. ASP.NET Core is a redesign of ASP.NET 4.x, with architectural changes that result in a leaner, more modular framework.

ASP.NET Core provides the following benefits:

A unified story for building web UI and web APIs.
Architected for testability.
Razor Pages makes coding page-focused scenarios easier and more productive.
Ability to develop and run on Windows, macOS, and Linux.
Open-source and community-focused.
Integration of modern, client-side frameworks and development workflows.
A cloud-ready, environment-based configuration system.
Built-in dependency injection.
A lightweight, high-performance, and modular HTTP request pipeline.
Ability to host on IIS, Nginx, Apache, Docker, or self-host in your own process.
Side-by-side app versioning when targeting .NET Core.
Tooling that simplifies modern web development.

These are just some of the benefits. My personal experience, I LOVE the performance of the .net core apps. I think it is off the chart or maybe I have been developing apps the wrong way all these years.

I love it that they have a really small learning curve if you are coming from .Net/MVC background. I love that how EASY it is to just configure the features I want that my "web server" to have from within my code. I love how easy it is to integrate client side frameworks with it. I love how quickly I can target different environments Dev/QA/SIT/PROD with couple of clicks... I dunno.. I think I can talk about this a lot more. but I will stop here.

You Like?

Regards,
Chinmay.
Yeah, I refrain from clicking until I know that's direction I would like to take - I can get sucked down the rabbit hole and distracted from my objectives. :^)
Thanks much!
That's the new avatar of Microsoft Developer Network (And I think you will love it... when you get some time, do have a look at it please.) And yes there is a greater chance that you will get distracted.