By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,838 Members | 1,626 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,838 IT Pros & Developers. It's quick & easy.

CSS Formatting not appearing on Login page

P: n/a
Hi,

I have an app which utilizes forms security. I have a Login.aspx page
which references my MasterPage.master. The master page in turn
references a css.

In the designer of VS 2005, the Login page renders correctly.... with
correct formatting as provided by my css.

At application runtime however, all formatting disappears on the login
page... no css formatting occurs at all.

Note that other pages in the app (ie. subsequent to login) appear
correctly formatted. This is puzzling!

Another hint : this was all working until I created a sub-directory
under the root of the app & moved web pages to there.

My ide is VS 2005 (completely up to date version).

Any ideas ?

Thanks,
Bazza

Mar 11 '07 #1
Share this Question
Share on Google+
11 Replies


P: n/a
On Mar 11, 8:32 pm, "Bazza Formez" <bruce_for...@clear.net.nzwrote:
Hi,

I have an app which utilizes forms security. I have a Login.aspx page
which references my MasterPage.master. The master page in turn
references a css.

In the designer of VS 2005, the Login page renders correctly.... with
correct formatting as provided by my css.

At application runtime however, all formatting disappears on the login
page... no css formatting occurs at all.

Note that other pages in the app (ie. subsequent to login) appear
correctly formatted. This is puzzling!

Another hint : this was all working until I created a sub-directory
under the root of the app & moved web pages to there.

My ide is VS 2005 (completely up to date version).

Any ideas ?

Thanks,
Bazza
Do you use an absolute path with slash at beginning to CSS?

e.g.

<link type="text/css" href="/style.css" rel="stylesheet">
Mar 11 '07 #2

P: n/a
Hi Alexey,

Thanks for your reply.

The code I had was :
<link href="styles.css" rel="stylesheet" type="text/css" />

(By the way ... The css is in the same directory as the masterpage.)

I have tried the following using an absolute path ....
<link href="~/mydirectory/styles.css" rel="stylesheet" type="text/
css" />

But this also gave same problem..

Any other ideas Alexey ?

Many thanks,
Bazza

Mar 11 '07 #3

P: n/a
Hi Alexey,

Thanks for your reply.

The code I had was :
<link href="styles.css" rel="stylesheet" type="text/css" />

(By the way ... The css is in the same directory as the masterpage.)

I have tried the following using an absolute path ....
<link href="~/mydirectory/styles.css" rel="stylesheet" type="text/
css" />

But this also gave same problem..

Any other ideas Alexey ?

Many thanks,
Bazza

Mar 11 '07 #4

P: n/a
On Mar 11, 9:03 pm, "Bazza Formez" <bruce_for...@clear.net.nzwrote:
I have tried the following using an absolute path ....
<link href="~/mydirectory/styles.css" rel="stylesheet" type="text/
css" />
This is wrong. The tilda-prefix "~" can be used for server-side
controls only.

So, please try

<link href="/mydirectory/styles.css" ....

If this still doesn't work, check if it's not the cache problem.
Refresh the login page with Ctrl+F5, or delete all cached files.

Mar 11 '07 #5

P: n/a
Thanks.

(In masterpage) I changed it to :

<link href="/mydirectory/styles.css" rel="stylesheet" type="text/css" /
...
still same prob.

Note that all other pages in site using same masterpage work fine....
Can you tell me where cached files live please ?

thanks,
Bazza

Mar 11 '07 #6

P: n/a
On Mar 11, 9:34 pm, "Bazza Formez" <bruce_for...@clear.net.nzwrote:
Thanks.

(In masterpage) I changed it to :

<link href="/mydirectory/styles.css" rel="stylesheet" type="text/css" /
...

still same prob.
So, let's check:

1. login.aspx used a master
2. login.aspx, masterpage, styles.css are in the same directory
(mydirectory)
3. site has the following structure:

root
------mydirectory
---------------login.aspx
---------------masterpage
---------------styles.css
---------------others

>
Note that all other pages in site using same masterpage work fine....

Can you tell me where cached files live please ?
You can remove the IE cache from menu (Tools - Internet Options,
Browsing History...). IE has a problem with caching the CSS and maybe
you cannot see the style because of this problem. Maybe you can try to
restart the web server.

Mar 11 '07 #7

P: n/a
I deleted cache.. no luck there.

1. yes, login.aspx uses the master page
2. login.aspx, master page * styles.css all in same directory
3. My directory structure is just as you have described....

Full structure (in case it helps) is :

root
-----web.config
-----web.sitemap
-----App_Code (asp.net folder)
---------------BLL directory
---------------DAL directory
-----App_Data (asp.net folder)
---------------mydb.mdb
-----MyDirectory directory
---------------styles.css
---------------masterpage.master
---------------login.aspx
---------------other aspx pages

Mar 11 '07 #8

P: n/a
On Mar 12, 10:42 am, "Bazza Formez" <bruce_for...@clear.net.nzwrote:
I deleted cache.. no luck there.

1. yes, login.aspx uses the master page
2. login.aspx, master page * styles.css all in same directory
3. My directory structure is just as you have described....

Full structure (in case it helps) is :

root
-----web.config
-----web.sitemap
-----App_Code (asp.net folder)
---------------BLL directory
---------------DAL directory
-----App_Data (asp.net folder)
---------------mydb.mdb
-----MyDirectory directory
---------------styles.css
---------------masterpage.master
---------------login.aspx
---------------other aspx pages
By the way, all was working ok until I added the My directory level
into the mix and & moved web pages, master & styles.css into that.

Mar 11 '07 #9

P: n/a
On Mar 11, 10:46 pm, "Bazza Formez" <bruce_for...@clear.net.nzwrote:
On Mar 12, 10:42 am, "Bazza Formez" <bruce_for...@clear.net.nzwrote:


I deleted cache.. no luck there.
1. yes, login.aspx uses the master page
2. login.aspx, master page * styles.css all in same directory
3. My directory structure is just as you have described....
Full structure (in case it helps) is :
root
-----web.config
-----web.sitemap
-----App_Code (asp.net folder)
---------------BLL directory
---------------DAL directory
-----App_Data (asp.net folder)
---------------mydb.mdb
-----MyDirectory directory
---------------styles.css
---------------masterpage.master
---------------login.aspx
---------------other aspx pages

By the way, all was working ok until I added the My directory level
into the mix and & moved web pages, master & styles.css into that.- Hide quoted text -

- Show quoted text -
I have really no idea what's wrong here.

Open your http://localhost/MyDirectory/login.aspx with no style, right
click - View Source. Check what was generated by ASP.NET. Make sure
that it is

<link href="/MyDirectory/styles.css" ...

Make sure that there no other CSS styles in use and HTML layout is
correct.

Try to save the source as a separated HTML file, e.g.
http://localhost/MyDirectory/login.htm to see if this work properly
with CSS in IE and in VS.NET.

Hope, it helps...

Mar 11 '07 #10

P: n/a
On Mar 12, 11:01 am, "Alexey Smirnov" <alexey.smir...@gmail.com>
wrote:
On Mar 11, 10:46 pm, "Bazza Formez" <bruce_for...@clear.net.nzwrote:


On Mar 12, 10:42 am, "Bazza Formez" <bruce_for...@clear.net.nzwrote:
I deleted cache.. no luck there.
1. yes, login.aspx uses the master page
2. login.aspx, master page * styles.css all in same directory
3. My directory structure is just as you have described....
Full structure (in case it helps) is :
root
-----web.config
-----web.sitemap
-----App_Code (asp.net folder)
---------------BLL directory
---------------DAL directory
-----App_Data (asp.net folder)
---------------mydb.mdb
-----MyDirectory directory
---------------styles.css
---------------masterpage.master
---------------login.aspx
---------------other aspx pages
By the way, all was working ok until I added the My directory level
into the mix and & moved web pages, master & styles.css into that.- Hide quoted text -
- Show quoted text -

I have really no idea what's wrong here.

Open yourhttp://localhost/MyDirectory/login.aspxwith no style, right
click - View Source. Check what was generated by ASP.NET. Make sure
that it is

<link href="/MyDirectory/styles.css" ...

Make sure that there no other CSS styles in use and HTML layout is
correct.

Try to save the source as a separated HTML file, e.g.http://localhost/MyDirectory/login.htmto see if this work properly
with CSS in IE and in VS.NET.

Hope, it helps...- Hide quoted text -

- Show quoted text -
Thanks so much for your help Alexey. I very much appreciate it.

Mar 12 '07 #11

P: n/a
OK.. problem now solved.

It turns out that the permissions were all wrong. Using the security
settings of the website administration tool I was able to correct
access permissions to directories such that CSS file was no longer
protected to a user that had not yet logged on.

Mar 12 '07 #12

This discussion thread is closed

Replies have been disabled for this discussion.