[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 547
  • Last Modified:

I just can't get my web page to work

I have never seen a more infuriating problem than this. Okay, I am building my first website using ASP.NET. I’m still a little new to HTML, CSS, ASP, etc, but I’m very used to .NET and Visual Studio. I started out with the default Web Forms template, and began modifying the Site.Master file and Site.css file to fit my site.
      I finished my home page with great results (for a first timer, most of it was just the header and footer taken from the master page), and decided to move on to my login page. After researching the built in ASP.NET login controls and messing around with page itself, I noticed that I was getting some JavaScript errors on my login page.
      I would show you what they were except that I can’t get to them right now. Why? Well I’ll explain. After messing around with the page for a few minutes trying to figure out what I messed up that could be causing the errors, I decided to simply role back that page to how it was two days before, since I hadn’t made too many changes to that page anyway.
      So I downloaded a copy of the project and copy/pasted the HTML from the old Login.aspx, to the active one (I did the same for my Login.aspx.vb). No errors! So I left my computer and ended off for the day, thinking I would just start over with that page, step-by-step, and figure out what caused the error.
      But when I got back to my computer today, things got really messed up. First off, when I loaded the page (before making any changes) the errors came back. So I went back into my old aspx file and re-copied the HTML (top to bottom, just like before). But this time when I reloaded the page, something different happened.
      Now keep in mind I did not make any change to the Site.Master page this whole time. But when I reloaded my login page, it gave me the page as it looked two days before, including the outdated header which at that time I was still in the middle of creating.
      So I figured it must be cached somewhere. In Internet Explorer: I tried Ctrl-F5 (which worked in the past); nothing, I tried clearing the cache (Safety->Delete browsing history…->Temporary internet files); nothing, I tried changing the cache settings (Internet Options -> General -> Settings [in Browser History section] -> Every time I visit a web page); still nothing.
      In Google Chrome I tried: Ctrl-F5 (which worked in the past), clearing the cache (Settings -> Show advanced settings… -> Clear browsing data ->Obliterate the following items from the beginning of time -> Empty the cache), and disabling the cache in the DevTools (F12->Settings -> General -> Disable cache (while DevTools is open)).
      None of these things worked, both browsers still showed the same outdated version of the web page. Now, any sane person might think that I changed something in the Site.Master file to set it back to how it used to be, but I’ve double checked the source code and it is still up to date. Cases in point being two buttons from the original template which I deleted from the source yet are still there somehow.
      Some interesting things to note are that if I open the web page in the Page Inspector is comes out right (so the source has definitely not been changed) and that after I rebooted the machine, I was able to use Ctrl-F5 to reload the page and it did come up correctly (but with the JS errors too). After that though I tried recopying the old HTML again to fix the errors, which promptly reset the header the the outdated form it was in before I restarted.
      So that’s my long story: a problem within a problem. Any ideas?
0
BROOKLYN1950
Asked:
BROOKLYN1950
1 Solution
 
Jerry MillerCommented:
I am assuming that the page looks correct in Visual Studio on the dev computer? If so, do a Rebuild Solution and copy your files back to the web server. After you have the updated files on the web server, you should see the correct version in all browsers.

Another question that I have. How is the site hosted? If it is on a service (Go Daddy, Host Gator, etc..), you may have multiple servers that are involved and there could be a replication issue with your hos service.

Without seeing your old and new HTML, it is hard to even begin to help troubleshoot the javascript error issue.
0
 
BROOKLYN1950Author Commented:
@jmiller1979
Sorry, I left this part out. I haven't moved the site to any publicly accessible location yet, I'm running it straight out of Visual Studio. I select my browser from the toolbar on top and then click Run (just like you would click in a win-forms project), it then runs the site using whatever built-in-IIS-thing which it has installed.
As far as the JavaScript error is concerned, I'm not too worried about that at the moment since I can't even get my page to load correctly. Besides, the errors weren't even coming from my JavaScript, they were coming from whatever JavaScript Visual Studio loads into the web page. I haven't even opened a single JavaScript file in this project.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
SolugaCommented:
When you have the page open for edit in VS what happens when you press F5 on your keyboard?
0
 
BROOKLYN1950Author Commented:
Okay, I don't know what I did differently, but when I came on today and hit F5 the site loaded correctly. So before I tried anything else I took a snapshot of the JavaScript errors I'm getting. This is what they look like out of the chrome browser:
A screenshot of the Google Chrome consoleAlso as I was writing this, I figured out what I did to cause them. Aside from the Site.css and the Site.Master, I also made a slight change to the web.config file, I added:
<authorization>
      <deny users="?"/>
</authorization>

Open in new window

I got the spinet from some Google searches, In an attempt to redirect all non-logged-in users from browsing the site. It works, but apparently whenever they are redirected to the log-in page I get these JavaScript errors. If I take out the above code from the config file, I can load the page without any errors, but unauthorized users can browse the site.
So naturally I started messing with the config file seeing if I could tweak it to get the intended results. Unfortunately I never found out whether or not my tweak worked because as soon as I made a single change to the config file and reloaded the page, I got the same outdated version of the page I had been getting yesterday. WHERE IS THIS OLD PAGE COMING FROM!?
So anyway, now I'm stuck until it decides to show me the right web page or until we can figure out why it's showing the old page to begin with.
Fingers crossed.
0
 
Jerry MillerCommented:
You need to put a breakpoint in the Page_Load event and follow the progression of the page. Both when it works and when it doesn't. Also take a look at the solution and make sure that there isn't any old pages left that could be causing the issue.
0
 
BROOKLYN1950Author Commented:
Sorry for the delay, I figured it out a few days ago. I'm sorry to say that none of your suggestions fixed my problem.
The problem was in that change I made to the web.config file, I'm not 100% sure why but it seems like it was denying access to allot more than just my web pages. I think it was denying access to pieces of the site that my log in page was referencing, resulting in a failure to load the page and thus some run-time errors. I'm not sure where that old version of the page was saved/cached but once I fixed the web.config file it stopped appearing and everything went back to how it should be.
Instead of denying access to the whole site (as shown in the snippet from my previous post),  I denied access to the specific web pages that I did't want any unauthorized access to using code like this:
    <location path="~/Default.aspx">
        <system.web>
            <authorization>
                <deny users="?" />
            </authorization>
        </system.web>
    </location>

Open in new window

0
 
BROOKLYN1950Author Commented:
I figured out the answer before anyone else did.
0
 
Jerry MillerCommented:
Glad you got it working, that is the ultimate goal. Yup, sometimes you figure it out be we do.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now