|
As much as I know, you should put the pages that you don't want to get access to in a folder and put a Web.Config file in that folder and set this tag:
<system.web><br />
<authentication mode="Forms"><br />
<forms loginUrl="login.aspx"/><br />
</authentication><br />
</system.web>
this way you will make users to login before they can see the content of this folder(they will be redirected to login.aspx automatically)!
And when you can Log some user in using:
System.Web.Security.FormsAuthentication.RedirectFromLoginPage();
you can log him out using:
System.Web.Security.FormsAuthentication.SignOut();
Sojaner!
|
|
|
|
|
A web designer that *sucks* gave me this HTML to build a dynamic news/event section with. The trouble is that the HTML isn't clean and something about it causes it to not look right. Is there a simpler way to do this maybe without divs. I've wasted 60 hours trying to make this crap work and I just don't know HTML well enough at all to make it look better.
Here's a link to how it looks and you can see the problem in the bottom of the events table.
http://www.code-frog.com/divs_suck.htm
Here's the code:
<table border="0" cellspacing="0" cellpadding="0" id="table5">
<tr>
<td><img border="0" src="table_title_recentnews.gif" width="282" height="22"></td>
</tr>
<tr>
<td background="background_recentnews.gif" valign="top" align="left" style="height: 133px"><div align="center">
<table border="0" width="274" cellspacing="3" cellpadding="0" id="table6">
<tr>
<td width="7" valign="top"><p align="center"> <font face="Tahoma"> <span style="font-size: 8pt">•</span></font></td>
<td width="267" valign="top"><font face="Tahoma" style="font-size: 8pt"> October 31, 2006 - All Saints Mass at BKHS1 at 9:30am.</font> <font face="Tahoma" style="font-size: 7pt"> <u><b><a href="SaintsMass1.aspx">more info</a></b></u></font></td>
</tr>
</table>
<div align="center">
<table border="0" width="274" cellspacing="3" cellpadding="0" id="table7">
<tr>
<td width="7" valign="top"><p align="center"> <font face="Tahoma"> <span style="font-size: 8pt">•</span></font></td>
<td width="267" valign="top"><font face="Tahoma" style="font-size: 8pt"> October 31, 2006 - All Saints Mass at BKHS2 at 9:30am.</font> <font face="Tahoma" style="font-size: 7pt"> <u><b><a href="SaintsMass2.aspx">more info</a></b></u></font></td>
</tr>
</table>
<div align="center">
<table border="0" width="274" cellspacing="3" cellpadding="0" id="table8">
<tr>
<td width="7" valign="top"><p align="center"> <font face="Tahoma"> <span style="font-size: 8pt">•</span></font></td>
<td width="267" valign="top"><font face="Tahoma" style="font-size: 8pt"> October 31, 2006 - All Saints Mass at BKHS3 at 9:30am.</font> <font face="Tahoma" style="font-size: 7pt"> <u><b><a href="SaintsMass3.aspx">more info</a></b></u></font></td>
</tr>
</table>
</div>
</div>
</div></td>
</tr>
<tr>
<td><img border="0" src="spacer_eight_pixels.gif" width="8" height="8"><br>
<img border="0" src="table_title_upcomingevents.gif" width="282" height="22"></td>
</tr>
<tr>
<td background="background_upcomingevents.gif" height="97" align="center" valign="top"><div align="center">
<table border="0" width="274" cellspacing="3" cellpadding="0" id="table14">
<tr>
<td width="7" valign="top"><p align="center"><font face="Tahoma"> <span style="font-size: 8pt">•</span></font></td>
<td width="267" valign="top"><font face="Tahoma" style="font-size: 8pt"> November 29, DWA1 - Freshman</font> <font face="Tahoma" style="font-size: 7pt"> <u><b><a href="Freshman1.aspx">more info</a></b></u></font></td>
</tr>
</table>
<div align="center">
<table border="0" width="274" cellspacing="3" cellpadding="0" id="table15">
<tr>
<td width="7" valign="top"><p align="center"><font face="Tahoma"> <span style="font-size: 8pt">•</span></font></td>
<td width="267" valign="top"><font face="Tahoma" style="font-size: 8pt"> November 29, DWA2 - Freshman</font> <font face="Tahoma" style="font-size: 7pt"> <u><b><a href="Freshman2.aspx">more info</a></b></u></font></td>
</tr>
</table>
<div align="center">
<table border="0" width="274" cellspacing="3" cellpadding="0" id="table16">
<tr>
<td width="7" valign="top"><p align="center"><font face="Tahoma"> <span style="font-size: 8pt">•</span></font></td>
<td width="267" valign="top"><font face="Tahoma" style="font-size: 8pt"> November 29, DWA3 - Freshman</font> <font face="Tahoma" style="font-size: 7pt"> <u><b><a href="Freshman3.aspx">more info</a></b></u></font></td>
</tr>
</table>
<div align="center">
<table border="0" width="274" cellspacing="3" cellpadding="0" id="table17">
<tr>
<td width="7" valign="top"><p align="center"><font face="Tahoma"> <span style="font-size: 8pt">•</span></font></td>
<td width="267" valign="top"><font face="Tahoma" style="font-size: 8pt"> November 29, DWA4 - Freshman</font> <font face="Tahoma" style="font-size: 7pt"> <u><b><a href="Freshman4.aspx">more info</a></b></u></font></td>
</tr>
</table>
</div>
</div>
</div>
</div></td>
</tr>
</table>
|
|
|
|
|
good GOD!!! This dude/chick makes my head spin with all those nested tables and divs. Uhh... maybe a CSS?!?!
Why don't you build your own structure, and place the *meat* where you want it to appear? Run them at server so you can manipulate the html elements for dynamic data insertion.
p.s.
Coffee (Nila)
|
|
|
|
|
Grapes-R-Fun wrote: Why don't you build your own structure
I'm attempting this but lack the experience to know how to produce the outlines that around each row and the subsequent tables. I *HATE* html.
|
|
|
|
|
Let me put something together for you then. In the meantime, are you using C# or VB.Net as your code behind?
Nila
|
|
|
|
|
C#
Here's what I'm trying to do: (I'm omitting a lot of code here and tried to keep it short and sweet.)
protected void Page_Load(object sender, EventArgs e)
{
PageContent _PG = new PageContent();
string tmpHTML = "";
tmpHTML += " <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"table5\">" + "\r\n";
tmpHTML += " <tr>" + "\r\n";
tmpHTML += " <td>" + "\r\n";
tmpHTML += " <img border=\"0\" src=\"table_title_recentnews.gif\" width=\"282\" height=\"22\"></td>" + "\r\n";
tmpHTML += " </tr>" + "\r\n";
tmpHTML += " <tr>" + "\r\n";
tmpHTML += " <td background=\"background_recentnews.gif\" valign=\"top\" align=\"left\" style=\"height: 133px\">" + "\r\n";
tmpHTML += _PG.BuildNewsContent();
tmpHTML += " </td>" + "\r\n";
tmpHTML += " </tr>" + "\r\n";
tmpHTML += " <tr>" + "\r\n";
tmpHTML += " <td>" + "\r\n";
tmpHTML += " <img border=\"0\" src=\"spacer_eight_pixels.gif\" width=\"8\" height=\"8\"><br>" + "\r\n";
tmpHTML += " <img border=\"0\" src=\"table_title_upcomingevents.gif\" width=\"282\" height=\"22\"></td>" + "\r\n";
tmpHTML += " </tr>" + "\r\n";
tmpHTML += " <tr>" + "\r\n";
tmpHTML += " <td background=\"background_upcomingevents.gif\" height=\"97\" align=\"center\" valign=\"top\">" + "\r\n";
tmpHTML += _PG.BuildEventContent();
tmpHTML += " </td>" + "\r\n";
tmpHTML += " </tr>" + "\r\n";
tmpHTML += " </table>" + "\r\n";
InLineHTML.Text = tmpHTML; //This InLineHTML is an ASP:LITERAL
}
public string BuildNewsContent()
{
string tmpHTML = "";
string _Result = "";
int _DivCounter = 0;
bool _bFirstPass = true;
int tableRow = 6;
while (thisReader.Read())
{
_DivCounter += 1;
tmpHTML += " <div align=\"center\">" + "\r\n";
tmpHTML += " <table border=\"0\" width=\"274\" cellspacing=\"3\" cellpadding=\"0\" id=\"table" + tableRow.ToString() + "\">" + "\r\n";
tmpHTML += " <tr>" + "\r\n";
tmpHTML += " <td width=\"7\" valign=\"top\">" + "\r\n";
tmpHTML += " <p align=\"center\">" + "\r\n";
tmpHTML += " <font face=\"Tahoma\">" + "\r\n";
tmpHTML += " <span style=\"font-size: 8pt\">•</span></font></td>" + "\r\n";
tmpHTML += " <td width=\"267\" valign=\"top\">" + "\r\n";
tmpHTML += " <font face=\"Tahoma\" style=\"font-size: 8pt\">" + "\r\n";
tmpHTML += thisReader["DateText"].ToString().Trim() + " - " + thisReader["SummaryText"].ToString().Trim() + "</font>" + "\r\n";
tmpHTML += " <font face=\"Tahoma\" style=\"font-size: 7pt\">" + "\r\n";
tmpHTML += " <u><b><a href=\"" + thisReader["MoreInfoURL"].ToString().Trim() + "\">more info</a></b></u></font></td>" + "\r\n";
tmpHTML += " </tr>" + "\r\n";
tmpHTML += " </table>" + "\r\n";
tableRow += 1;
}
for (int i = 1; i < _DivCounter + 1; i++)
{
tmpHTML += "</div>" + "\r\n";
}
_Result = tmpHTML;
return _Result;
}
public string BuildEventContent()
{
string tmpHTML = "";
string _Result = "";
int _DivCounter = 0;
bool _bFirstPass = false;
int tableRow = 14;
while (thisReader.Read())
{
if (_bFirstPass == false)
{
tmpHTML += " <div align=\"center\">";
_DivCounter += 1;
}
else
{
_bFirstPass = false;
}
tmpHTML += " <table border=\"0\" width=\"274\" cellspacing=\"3\" cellpadding=\"0\" id=\"table" + tableRow.ToString() + "\">" + "\r\n";
tmpHTML += " <tr>" + "\r\n";
tmpHTML += " <td width=\"7\" valign=\"top\">" + "\r\n";
tmpHTML += " <p align=\"center\"><font face=\"Tahoma\">" + "\r\n";
tmpHTML += " <span style=\"font-size: 8pt\">•</span></font></td>" + "\r\n";
tmpHTML += " <td width=\"267\" valign=\"top\">" + "\r\n";
tmpHTML += " <font face=\"Tahoma\" style=\"font-size: 8pt\">" + "\r\n";
tmpHTML += thisReader["EventText"].ToString().Trim() + "</font>" + "\r\n";
tmpHTML += " <font face=\"Tahoma\" style=\"font-size: 7pt\">" + "\r\n";
tmpHTML += " <u><b><a href=\"" + thisReader["MoreInfoURL"].ToString().Trim() + "\">more info</a></b></u></font></td>" + "\r\n";
tmpHTML += " </tr>" + "\r\n";
tmpHTML += " </table>" + "\r\n";
tableRow += 1;
}
for (int i = 0; i < _DivCounter; i++)
{
tmpHTML += "</div>" + "\r\n";
}
_Result = tmpHTML;
return _Result;
}
|
|
|
|
|
That could be fairly simple repeater control... When I get home I'll write it.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
Yeah, I've not ever used a repeater before. I'll look into that and see if I can solve the mystery.
|
|
|
|
|
|
OMG, your flash website looks REALLY cool! Did you develop it, or did you hire someone to do it for you?
Nila
|
|
|
|
|
Actually a guy I work with a lot did it for me. We are not quite done yet but pretty close.
|
|
|
|
|
It looks awesome!
Nila
|
|
|
|
|
Looks like that background image is not tall enough.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
I was just trying to fix this but didn't know how to do it dynamically. What if there are 10 rows at one point but only 3 the next week? How do I make it scale?
|
|
|
|
|
well I would define some minimal height (not in css, but physical height of your background picture), and everything extra would be just white background => so table (td, tr?) would have both background picture and background color. Pic fading from gray to white, following by white background - as many pixels as needed. Uh, you know what I mean.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
This is what I've come up.
// default.aspx
<form id="Form1" method="post" runat="server" >
<asp:repeater runat="server" id="rptNews">
<HeaderTemplate>
<table border="0" width="274" cellspacing="3" cellpadding="0" id="news-table" class="myTable" >
<th> <!-- Recent News --></th>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# Eval("Text") %>
<a href="">more info</a>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:repeater>
<asp:repeater runat="server" id="rptEvents">
<HeaderTemplate>
<table border="0" width="274" cellspacing="3" cellpadding="0" id="events-table" class="myTable" >
<th> <!-- Upcoming Events --></th>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# Eval("Text") %>
<a href="">more info</a>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:repeater>
</form>
// stylesheet
.myTable
{
background-color:white;
border-style:solid;
border-width:1px;
border-color:black;
background-image:url('http://www.code-frog.com/background_recentnews.gif');
background-position:bottom;
background-repeat:no-repeat;
margin:10px;
padding:0px;
}
#news-table th
{
background-image:url('http://www.code-frog.com/table_title_recentnews.gif');
}
#events-table th
{
background-image:url('http://www.code-frog.com/table_title_upcomingevents.gif');
}
In my test page I used ArrayList filled with random amount of ListItem objects, worked fine. While it doesnt look 100% as your current page, it takes just a little playing with css to make table header look like original. By the way, IMO it's better use text then image when possible for these things like table headers, it's important information about page structure - if i put into google "code frog upcoming events" I want to find that page, it's way easier to find it when *text* "upcoming events" is on that page, rather then image...
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
Hey DNH, good to see you. Hope everything is going well. I remember way back when I first started doing ASP .Net you offering me some good advice. Things have gone well from there but my HTML is horrid (and I'm okay with that) and it sometimes causes problems when I'm given bad HTML to work with.
|
|
|
|
|
Did you solve this yet, Rex?
|
|
|
|
|
hi there,
i am trying to uatomate login using httpwebrequest it does all the work correctly but when i try to redirect to the welcome page with the cookie headers that i got from the last post it redirect me to login , this is my code, any help plz?
// making post with login data
PostData = "login_username=clude&secretkey=taamea&js_autodetect_results=1&just_logged_in=1";
Url = "http://webmail.cleanercorners.com/src/redirect.php";
sReferer = "http://webmail.cleanercorners.com/src/login.php";
webRequest = (HttpWebRequest)WebRequest.Create(Url);
webRequest.Headers["Accept-Language"] = "ar-eg"; //"en-us"; //ar-eg
//webRequest.ProtocolVersion = HttpVersion.Version11;
webRequest.AllowAutoRedirect = false;
webRequest.Referer = sReferer;
webRequest.KeepAlive = true;
//webRequest.ContentType = "";
webRequest.UserAgent = " Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
webRequest.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*";
// making a post
ASCIIEncoding encoding = new ASCIIEncoding();
encodedPostData = encoding.GetBytes(PostData);
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.ContentLength = encodedPostData.Length;
Stream requestStream = null;
requestStream = webRequest.GetRequestStream();
requestStream.Write(encoding.GetBytes(PostData), 0, PostData.Length);
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
requestStream.Close();
// getting the cookies from the response
cookies = res.Headers["Set-Cookie"] ;
string[] sCookiesParts = cookies.Split(new char[2] { ';', ',' });
string sFormatedCookies = sCookiesParts[0] + ";" + sCookiesParts[2] + ";" + sCookiesParts[6];
//HttpCookie cookie1 = new HttpCookie("Cookie", sFormatedCookies);
//Response.Cookies.Add(cookie1);
// redirect with cookies
Response.AddHeader("Cookie", sFormatedCookies);
Response.Redirect("http://webmail.cleanercorners.com/src/webmail.php");
|
|
|
|
|
I have a aspx page which contains a combobox and button. Inintially button will be invisble. When i select tthe third element in the combo the button should be visible. i made autopostback of combo to true. I am filling the combobox on formload when page.ispostback is false. But when the page is posted back by combo i am not able to see the button. moreover the combo also becomes empty. can anyone tell the reson?
Thanks and regards
Hari
|
|
|
|
|
Than you probably doin' strange stuff in your page load event.
Take a look at this[^] page to gather some more information about page events and learn to use them..
|
|
|
|
|
Hi
I need to create a proxy website.Ny idea how to do it>?
Sankalp Verma
|
|
|
|
|
Hi all,
I want to put an download link, when viwer click on the clink the relavent file has to be download. I dnt want to manage the file in zip format. If the user uploades the file as document, he can able to download the same file in document format and save in the local system.
Plz any one suggest me..............
Thanks in advance
Bye
Know is Drop, Unknown is Ocean
Know is Drop, Unknown is Ocean
|
|
|
|
|
Read my article it will give you some pointers on how you can achieve this
Article Here
|
|
|
|
|
how to insert asp.netcheckbox to a datagrid column to select individual records,
|
|
|
|