SteveG
SteveG

Reputation: 23

How can 'View Page Source' be different to page rendered?

We (at work) had a design company build a static website in html5, and I've tied in ASP.Net code behind to make it functional. The log in screen contains a form thus:

<input class="ui-input-text ui-body-c" id="txtUsername" placeholder="Username&hellip;" value="" runat="server" />
<input class="ui-input-text ui-body-c" id="txtPassword" placeholder="Password&hellip;" value="" runat="server" type="password" />
<span class="select-decoration submit login">
       <input class="submit-button" id="btnLogin" value="Login" type="submit" runat="server" onserverclick="submitbutton_click" />
</span>

...and after validating the log-in I do a Response.Redirect to the 'home' screen.

The problem I have is although the page appears to load, if you 'View Page Source', the code presented is still the log-in page, the url in the address bar is still the log-in page; and since the log-in is at root and all contents pages are in a '/v2' sub directory, none of the paths to images are valid so nothing displays.

Oddly though, if you use the 'F12' tools in the browser, the html for inspection is the correct html. This behavior is true of IE 10, Firefox and Chrome.

I've tried both the true and false flags for Response.Redirect (mostly out of desperation, there is no further code to execute anyway) with no joy.

Everything I've found on here and google refers to PostBackTriggers, but I'm not using an UpdatePanel so no joy there.

I'm convinced this is something to do with HTML5, but it's new territory for me so I'm floundering.

Upvotes: 1

Views: 384

Answers (1)

Tobias
Tobias

Reputation: 2840

I assume that you're not actually setting a cookie or anything, and that if you refresh the home page after you've been validated, you will be sent back to the login page? If that is the case, the problem lies in that when you 'View Page Source', the browser isn't actually giving you the current HTML of the page you're on. It is actually getting it all from the server again, just like a normal request, the only difference is that the browser is now showing you the HTML instead of rendering it. This is also the reason that F12 developer tools DOM-inspector can show you the current HTML, since that is indeed showing you the current HTML in real time. I hope I'm being clear, and that I assumed correctly, I don't have a high enough reputation to comment. :)

Upvotes: 1

Related Questions