r/visualbasic • • May 17 '20

VB.NET Help 2 Beginner questions

I am using Visual Basic 2015.

This is my situation. I am a back office programmer. I do Oracle programming. Recently I have been given the task of maintaining a VB.Net web page. I used to code in VB in the past, so management picked me to maintain it. They will not hire anyone to maintain the web page. I have to do it.

I have been thrown into the deep end of the pool and I have to learn how to swim fast.

I have 2 question VB.Net. We are not using MVC.

1.) When making a new web page how do you make it available for others to use. I am aware that IIS is involved. Do you all have a link(s) that show how to do this.

2.) How do you make changes to existing web pages. Suppose the user wants a new command button that does something. In the past it meant a new executable. How do you put in a new features to an existing web page. Do you all have a link(s) that show how to do this.

Any help will be appreciated.

Thanking you all in advance.

7 Upvotes

10 comments sorted by

2

u/Mortiouss Database Specialist May 17 '20
  1. You need a place to host it, IIS is needed for that. Read up on installing IIS, it’s much more involved than what can be posted here, especially when dealing with internet facing apps, you want someone to hack your network, screw up an IIS installation.

Another option is to install something like plesk on a server, that handles provisioning sites and getting everything set up for you.

2. I’m assuming your asking about getting a button to do something, you have two sides of websites, client side and server side. Client side is what the client sees when opening the website (html, controls...) and server side is what is executed on the back end, so say you want the button to open a new page, on click your server side would do a response.redirect(“page.aspx”) page.aspx has to exist either as a page in your project or somewhere else (like google.com).

Good luck, walking into this without knowing anything is going to be a daunting task, web apps are so different than computer apps (.exes) if you want to do anything crazy you need to worry about page state, if you want to deal with database calls or inserts you need to worry about connections and closing/cleaning them up as soon as possible.

2

u/General_Fear May 17 '20

Thanks for the reply. The company will not hire anyone. In fact, they are talking about getting rid of people. So they gave me the web page.

At the moment all I have to do is add new reports to an existing web page. Hopefully it will not be to hard.

1

u/Mortiouss Database Specialist May 18 '20

Really hate to say but you have been put in a bad situation.

It sounds like the site is already operational so that’s a good thing, as long as you have the project file you should be able to hack together things you need. If you were to do this from scratch and be the only person to help, it would have been much tougher.

2

u/andrewsmd87 Web Specialist May 17 '20

To make it accessible, you need a web server. You set up IIS, then create a website, point the directory of the site to wherever this project is, and if it's set up properly, it should work. Note we don't know if this is a web forms, classic asp, or win forms project. When you look at the files are there files with a .aspx file extension in there?

Making changes depends on the type of project, because you can set them up so you have to build and deploy dlls, or it can be set up to where you simply change the backend/front end file, and it will rebuild itself basically and show the change. Not sure what you can and can't share but any examples of the files structure and/or code would probably be helpful

1

u/General_Fear May 18 '20 edited May 18 '20

The file extension are .aspx and .aspx .vb

In terms of file structure, what are you looking for?

1

u/andrewsmd87 Web Specialist May 18 '20

That means it's web forms. So simply putting that project I'm a folder where an iis website is pointing and then stopping up dns properly should host it

1

u/General_Fear May 18 '20

Thanks.

This will point me in the right direction.

1

u/andrewsmd87 Web Specialist May 18 '20

Just some other points. Your company is really putting you in a difficult position, not having much experience with web stuff. If this is going to be public facing, meaning you could access it outside your companies internal network, then you could potentially open yourself up to a TON of security exploits. Just due to you being mostly a DBA guy and then trying to shove something onto you you're not 100% familiar with.

If you can lock this thing down behind a VPN, that's the first thing I'd do. That will at least keep the internal security risks to someone within the company.

My guess is, it probably already has some type of authentication and what not, as web forms as pre built stuff for that, if you set it up right.

Other than that, some basics I can give you are the aspx pages are the "front end" and the aspx.vb pages are the back end or code behind. I put front end in quotes because you'll see some html in there, but then controls that look like

<asp:label id="someId" runat="server" text="Something" />

Whenever you see a tab with runat="server" that is a web forms control. What goes on in the background is the server processes that tag and generates the appropriate html tag. This is the simplest example, but the above tag would generate

<span id="ct100_somePage_someControl_someId">Something</span>

Where somePage would be a page, someControl would be the control it's in, and then someId, the id you gave it. That varies based on how the project and current page is set up, if they have master pages, multiple controls, etc.

The runat server part means you can access the tag in your code behind and do something. So say you needed to set the text and color based on some db field

In your vb it would look something like

someId.Text = theDbValue

if(theDbValue < 0) THEN 
    someId.Color = System.Drawing.Color.Red
ELSE
    someId.Color = System.Drawing.Color.Green
END IF

So say theDbValue was 5, you would get

<span id="ct100_somePage_someControl_someId" style='color:green'>5</span>

The controls get way more complicated than that, but that's a start.

1

u/General_Fear May 19 '20

Thanks man. It helps.

My website is in house for a few users. It has a login screen. The purpose of the web page is to dispense report. The user enters a few parameters like date and out comes the report.

0

u/[deleted] May 18 '20

[deleted]

1

u/General_Fear May 19 '20

Thanks.

The web page hasn't changed in years. No sooner the person in charge of the web page announces she was leaving, bang, the users want new reports.