• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 71
  • Last Modified:

rename .html to aspx - any issues

I already have a working javascript - html5 application on my intranet website ... Default page in that website is index.html

Now, I need  to check who is current windows domain-user logged in. So I am planning  to create ASPX page just to check currently logged in user...  Because in JavaScript there is no way to find out currently logged-in user )  
So I am planning to get userid by using this csharp code -

String username = User.Identity.Name; /// in index.aspx.cs

Now if I change extension of index.html to index.aspx and in index.aspx.cs I write the code above and everything else remains same(like css, javascript code of index.html and other pages)  will my website work in the same way as before
 
thanks a lot...
0
ts84zs
Asked:
ts84zs
  • 3
  • 3
3 Solutions
 
Tom BeckCommented:
I think you just need to wire it up in a directive at the top of the page. Example:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Abstimmung.aspx.cs" Inherits="Schulsprecher.Abstimmung" %>

Open in new window


Of course if you needed to access any of the controls on the page in the code behind you would need runat="server" on those as well to make them HTML server Controls.
0
 
ts84zsAuthor Commented:
Yes, i will write everything required for aspx and aspx.cs code

Only concern is if I keep my js, css, html code the same and create index.aspx and index.aspx.cs (with code related to aspx like codebhind etc) and just copy paste javascript/css/html part of index.html into index.aspx will there be any problems as far as look and feel and javascript-functinality of the page is concerned?

thanks so much
0
 
Tom BeckCommented:
Asp.net can render plain vanilla HTML pages just fine. Javascript runs on the client so .net is out of the picture at that point.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
ts84zsAuthor Commented:
what do  you mean by plain vanilla html pages
My html page is like lot of css, divs etc will it be displayed properly?
0
 
Tom BeckCommented:
By plain vanilla I mean html pages that do not rely on server side code to generate markup. No matter how much css, or javascript or what html tags you use, if a web browser can interpret that markup now BEFORE you run it through .net, then it will be able to interpret it AFTER you run it through .net. Asp.net can only act upon markup inside <%> tag blocks, asp.net web controls like <asp:TextBox and HTML controls with the runat="server" attribute value. Everything else is passed through "as is".  If the only thing on your page is a directive at the top then everything below it will be passed through to the client browser.
0
 
ts84zsAuthor Commented:
ok got it ... thanks a lot
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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