8 Replies - 1262 Views - Last Post: 22 April 2012 - 02:24 PM Rate Topic: -----

#1 IamTw_  Icon User is offline

  • D.I.C Head

Reputation: 32
  • View blog
  • Posts: 238
  • Joined: 25-February 11

Html and CSS + asp.net

Posted 19 April 2012 - 03:27 PM

Hi, I have two questions, not really related, but instead of creating one thread for each, I'll ask them here.
1)
I have created a login system in asp.net, and those who work with asp.net have probably tried this too.
The problem is... I have created a site(login page) that asks for verification when the user wants to enter a specific page. The problem is that when I want to test run (debug) any page, e.g my index page, it asks for verification. So must I place the code so that I dont need to verification to enter all pages?

2)
The second question is... I have written some code for adding a background image, but it wont always find the image. Sometimes when I add some more code, it suddenly just show white background. From what I found on google, it has something to do with my url, wether I type the absolute path or not, etc. But I have tried both, and I can't see to make it work. Here are some code examples:
<body>
        <form id="form1" runat="server">
        <div class="contentPane" />
            <div>
                <h3>Login required</h3>
                <p>You can use email address to login</p>
            </div>

        <div>
</body>


And the CSS looks like that
*{margin: 0px; padding: 0px; }

body 
{
    background-image: url('http://localhost:50614/JamesImages/LoginImages/Login.png');   
}

.contentPane
{
    background-image: url('http://localhost:50614/JamesImages/LoginImages/innerLoginBG.png');
    display: block;
    margin-left: auto;
    margin-right: auto;
    padding-top: 20px;
}


I have also tried the below, and also use use the ~
body 
{
    background-image: url('LoginImages/Login.png');   
}


Thanks in advance

Is This A Good Question/Topic? 0
  • +

Replies To: Html and CSS + asp.net

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 6462
  • View blog
  • Posts: 23,493
  • Joined: 12-June 08

Re: Html and CSS + asp.net

Posted 19 April 2012 - 04:53 PM

RE #1:
Well it should ask for each page.. if I know page1.aspx requires a login.. but page2.aspx doesn't what will stop me from just navigating to page2 and bypassing the whole thing? What should happen is the session variable validating the user (from page1.aspx) - if it is not present (all subsequent pages must do a check for this) it redirects the user to page1...


RE #2:
Why are you hard coding the path and port number? .NET likes to randomly assign port numbers - just make the path relative to the directory the pages are in and it should work fine.
Was This Post Helpful? 1
  • +
  • -

#3 IamTw_  Icon User is offline

  • D.I.C Head

Reputation: 32
  • View blog
  • Posts: 238
  • Joined: 25-February 11

Re: Html and CSS + asp.net

Posted 20 April 2012 - 02:33 AM

View Postmodi123_1, on 19 April 2012 - 04:53 PM, said:

RE #1:
Well it should ask for each page.. if I know page1.aspx requires a login.. but page2.aspx doesn't what will stop me from just navigating to page2 and bypassing the whole thing? What should happen is the session variable validating the user (from page1.aspx) - if it is not present (all subsequent pages must do a check for this) it redirects the user to page1...


RE #2:
Why are you hard coding the path and port number? .NET likes to randomly assign port numbers - just make the path relative to the directory the pages are in and it should work fine.

Hi, thanks for the reply
RE #1:
It shouldn't ask for each page. Right now, if a user writes: www.myURL.com, it is gonna as for verification before the user can even enter my site. This would like... When a user type: www.dreaincode.net, he would have to verify before even haven to com in to the front page, or ANY forum. This is not what I want, I only want a user to be able to verify when he tries to enter a page that lies in www.myURL.com/Images/parties/upload as an example. Right now the user can't enter anything at all, unless he has a pass and username.

RE #2
I did try to use the realative pass, but it doesn't work, so I just drag and dropped the image in to the CSS, and it made the port itself.
As mentioned, I used the relative path
body 
{
    background-image: url('LoginImages/Login.png');   
}


Sometimes, it will work, but if I write some more code (such as adding an input box or so, which has nothing to do with images or background), it decides to just show white background again.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 6462
  • View blog
  • Posts: 23,493
  • Joined: 12-June 08

Re: Html and CSS + asp.net

Posted 20 April 2012 - 07:21 AM

re #1 - okay well then all those pages need to be setup in the way I mentioned. If you have five pages in a folder that require validation to access then on their 'load' event they darn well better check for a session variable saying that user can be there and if not direct them to the login page of that set.

re#2 - the relative path will work. How are you folders structured? Where is this css in relation to your images? My guess is you just borked a path in there. Don't just drag and drop all willy nilly go in there and actually *DO* the html work!
Was This Post Helpful? 1
  • +
  • -

#5 IamTw_  Icon User is offline

  • D.I.C Head

Reputation: 32
  • View blog
  • Posts: 238
  • Joined: 25-February 11

Re: Html and CSS + asp.net

Posted 20 April 2012 - 11:31 AM

View Postmodi123_1, on 20 April 2012 - 07:21 AM, said:

re #1 - okay well then all those pages need to be setup in the way I mentioned. If you have five pages in a folder that require validation to access then on their 'load' event they darn well better check for a session variable saying that user can be there and if not direct them to the login page of that set.

re#2 - the relative path will work. How are you folders structured? Where is this css in relation to your images? My guess is you just borked a path in there. Don't just drag and drop all willy nilly go in there and actually *DO* the html work!

re #1 - I don't really understand. How will I let it know that this specific folder doesn't require validation?
The Page_Load() body of all these pages are empty, I havent writen code for them yet.

Re #2 - My folders are like this. I have my Images in two folders, one called Images, and another called LoginImages. The Both the CSS for handling these images are in the same folder calles CSS. So the CSS to handle a page that should show LoginImages has the path CSS/LoginPage.css, and the reference to it is like this:
<link href="CSS/LoginPage.css" rel="stylesheet" type="text/css" />


This post has been edited by IamTw_: 20 April 2012 - 11:32 AM

Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 6462
  • View blog
  • Posts: 23,493
  • Joined: 12-June 08

Re: Html and CSS + asp.net

Posted 20 April 2012 - 11:50 AM

re#1 - the folder is irrelevant to this - I assumed you were using it just to group like documents.. Say you have five pages.. they require a login, right? You have six other pages that don't... those five need to check for the session variable telling them the user has logged in... if it's not present redirect them to the login page. that is something you have to code in.
Was This Post Helpful? 0
  • +
  • -

#7 IamTw_  Icon User is offline

  • D.I.C Head

Reputation: 32
  • View blog
  • Posts: 238
  • Joined: 25-February 11

Re: Html and CSS + asp.net

Posted 21 April 2012 - 03:27 AM

View Postmodi123_1, on 20 April 2012 - 11:50 AM, said:

re#1 - the folder is irrelevant to this - I assumed you were using it just to group like documents.. Say you have five pages.. they require a login, right? You have six other pages that don't... those five need to check for the session variable telling them the user has logged in... if it's not present redirect them to the login page. that is something you have to code in.

I have one page that requires verification, all the other pages don't. Do you have an example on how I make the other pages not to check for this session (Or what I should search for to find info about it)? Cus I never wrote (deliberately) that they should check for any cookie, and obviously they do. The only place I can think of, is in the web.config file, which looks like this.
<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="MySql.Data, Version=5.0.9.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
      </assemblies>
    </compilation>

    <authentication mode="Forms">
      <forms loginUrl="Login.aspx" name=".ASPXFORMSAUTH" timeout="30"/>
    </authentication>

    <authorization>
      <deny users="?" />
      <allow users="*"/>
    </authorization>
  </system.web>

  <connectionStrings>
    <add providerName="MySQLProv" name="connMySql"
         connectionString="... "/>
  </connectionStrings>
</configuration>



Also, do you know what the
name=".ASPXFORMSAUTH"


does? The tutorial didn't do much explaination out of this (the whole login system tutorial) in general I think

This post has been edited by IamTw_: 21 April 2012 - 03:31 AM

Was This Post Helpful? 0
  • +
  • -

#8 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 6462
  • View blog
  • Posts: 23,493
  • Joined: 12-June 08

Re: Html and CSS + asp.net

Posted 21 April 2012 - 08:04 AM

*sigh* So only one page is needed to login? Well hell - then only have the login bit check there! Don't include the code in the other pages.. boom! you are done.
Was This Post Helpful? 0
  • +
  • -

#9 IamTw_  Icon User is offline

  • D.I.C Head

Reputation: 32
  • View blog
  • Posts: 238
  • Joined: 25-February 11

Re: Html and CSS + asp.net

Posted 22 April 2012 - 02:24 PM

View Postmodi123_1, on 21 April 2012 - 08:04 AM, said:

Well hell - then only have the login bit check there! Don't include the code in the other pages.. boom! you are done.

Yea, I figured out that much at the begining, but like I mentioned, the problem is that I have no clue where to change this. I didn't include or change any code in the other pages (the pages that don't require login) when I created the verification system, I only added the code in the web.config file, and and the html code that should generate the login page.

But thanks for the attempt, I'll try to find other means :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1