ASP Login Not Working - html

So previously my login worked fine. And then I made some edits and it stopped working. Here are the edits I made to my website in between it going from working to not working.
I was trying to make a submit content page but I kept getting errors about not being able to contain a form inside a form. So I went over to my master page and removed the form tag and then added all the form tags I needed into each individual page. In the end I ended up removing all form tags and putting a single form tag around the content place holder in the master page.
I added a new table to my SQL database to store content submitted by users. I use Microsoft Server Express for my database.
The error I am getting is not an error in my console, it is just that my PostBackURL is loaded with out anything happen. Even if I enter a correct login (I have checked and the login info I tested is stored in my database), it will just automatically load the PostBackURL with no login occuring, nor any Login failed messages.
Web Config:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
<authentication mode="Forms">
<forms loginUrl="login.aspx" name=".ASPXFORMSAUTH">
</forms>
</authentication>
</system.web>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>
</configuration>
Master Page (Relevant Parts):
<body>
<form id="form1" runat="server">
<div class="header headerLogin">
<img style="margin-left: 5vw; margin-top: 5px; height: 32px; width: 130px;" src="images/inshortlogo.png" />
<p class="taskbarLinks">
HOME
NEWS
JOB LISTINGS
STUDY
LOGIN
</p>
<script>
...
</script>
</div>
<div>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
Login Page:
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="Absolute-Center">
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
<asp:Login ID="Login1" runat="server">
<LayoutTemplate>
<table cellpadding="1" cellspacing="0" style="border-collapse:collapse;">
<tr>
<td>
<table cellpadding="0">
<tr>
<td align="center" colspan="2">Log In</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label>
</td>
<td>
<asp:TextBox ID="UserName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="ctl08$Login1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
</td>
<td>
<asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password" ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="ctl08$Login1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="2">
<asp:CheckBox ID="RememberMe" runat="server" Text="Remember me next time." />
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color:Red;">
<asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="LoginButton" runat="server" CommandName="Login" CssClass="button" PostBackUrl="~/home.aspx" Text="Log In" ValidationGroup="ctl08$Login1" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:Login>
<br />
<div style="text-align: center;">
<a class="button" style="margin-right: 2em;" href="signup.aspx">Register</a>
<a class="button" href="forgotpassword.aspx">Forgot Password</a>
</div>
</AnonymousTemplate>
<LoggedInTemplate>
<asp:Label ID="logOutLabel" runat="server" Text=""></asp:Label>
<br />
<br />
<div style="text-align: center;">
<asp:LinkButton ID="logOutButton" runat="server" class="button" OnClick="logOutButton_Click">Log Out</asp:LinkButton>
</div>
</LoggedInTemplate>
</asp:LoginView>
</div>
<style>
.Absolute-Center {
position: absolute;
top: 50%;
left: 50%;
-moz-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
</style>
</asp:Content>
Thanks in advance!

Remove the postbackurl. That posts the form to another page, so of course you don't get logged in. Instead, upon successful login, perform a redirect to whatever page you want.

Related

how to control space between radiobuttons of the radiobuttonlist control

I am having lot of space between newly added radiobuttons(yes and No) of the RadioButtonList and the first part of the existing region(divName) is aligned properly.
can any body help me in aligning the newly added second region(div1)
<div id="divpanelFacts" runat="server">
<fieldset id="panelFacts">
<table width="100%">
<tr>
<td>
<div id="divName" runat="server" visible="false">
<span>
<label runat="server" id="Label1">
<span id="pNameSpan" runat="server">*</span>P Name</label>
<asp:TextBox ID="textPName" runat="server" MaxLength="20"></asp:TextBox>
</span>
</div>
</td>
<td>
<div id="div1" runat="server" visible="false">
<asp:Label ID="lbl1" runat="server" Text="Would like to use this option for document purpose"></asp:Label>
<asp:RadioButtonList ID="rbl1" runat="server" TextAlign="Left" RepeatDirection="Horizontal">
<asp:ListItem Value="Yes" Text="Yes" />
<asp:ListItem Value="No" Text="No" Selected="True" />
</asp:RadioButtonList>
</div>
</td>
</tr>
</table>
</fieldset>
</div>
Your table width is at 100%, which means it's going to stretch it, and table I think takes precedence.

HTML controls not working under <td> tag in ASP.NET page

I am working to get a HTML File Upload control in place in a ASPX Web Form page. I have used the below code
<td class="ClientDetailTableLeftColumn">
<asp:Label ID="lblUpload" runat="server" Text="Upload File"></asp:Label>
</td>
<td "ClientDetailTableControls" colspan="2">
<p id="UploadArea">
<input id="FileUploadInput" type="file" size="20"/>
<asp:Button ID="btnUpload" runat="server" Text="Click To Upload" CssClass="btnFormSubmit" />
</p>
<input id="btnUploadMore" type="button" value="Add New Attachment" onclick="AddUploadBox" />
</td>
But while running in Local IIS I am getting an error.
System.Web.UI.HtmlControls.HtmlTableCellCollection must have items of
type System.Web.UI.HtmlControls.HtmlTableCell'. 'p' is of type
System.Web.UI.HtmlControls.HtmlGenericControl'.
The code is failing in the 2nd Line :
Line 85: <td "ClientDetailTableControls" colspan="2">
Line 86: <p id="UploadArea">
Can somebody please help me what could be the resolution to this? Or why is this failing?
Try this
<td class="ClientDetailTableLeftColumn">
<asp:Label ID="lblUpload" runat="server" Text="Upload File"></asp:Label>
</td>
<td "ClientDetailTableControls" colspan="2">
<div id="UploadArea">
<input id="FileUploadInput" type="file" size="20"/>
<asp:Button ID="btnUpload" runat="server" Text="Click To Upload" CssClass="btnFormSubmit" />
</div>
<input id="btnUploadMore" type="button" value="Add New Attachment" onclick="AddUploadBox" />
</td>

Aligning navigation menu in visual basic

Here's my full code. I haven't modify my default css code. Does anyone know how to align nav bar to the right next to the logo? Please note I am currently learning visual basic web application building and my knowledge is very limited on this area.
thanks
<%# Page Language="vb" AutoEventWireup="false" CodeBehind="default.aspx.vb" Inherits="Wiltshire_mobile._default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
font-size: large;
}
.style2
{
text-align: right;
}
.style3
{
width: 162px;
height: 83px;
border-width: 0px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="style2">
<asp:Button ID="mysiteloginbutton1" runat="server" Text="My Site Login" BackColor="#FF9900"
ForeColor="White" Style="text-align: right" /> <span class="style1"><strong
style="text-align: left">Sign up | Help |<asp:DropDownList
ID="DropDownList1" runat="server" AutoPostBack="True">
<asp:ListItem>English</asp:ListItem>
<asp:ListItem>Bangla</asp:ListItem>
</asp:DropDownList>
</div>
<div>
<a href="http://www.wiltshire-mobile.com">
<img alt="Wiltshire mobile website logo" class="style3" src="Images/logo.PNG" /></a> <span class="style1"><strong
style="text-align: left">
<asp:Menu ID="Menu1" runat="server" StaticSubMenuIndent="16px">
<Items>
<asp:MenuItem Text="Home" Value="Home"></asp:MenuItem>
<asp:MenuItem Text="Features" Value="Features"></asp:MenuItem>
<asp:MenuItem Text="Tour" Value="Tour"></asp:MenuItem>
<asp:MenuItem Text="Plans" Value="Plans"></asp:MenuItem>
<asp:MenuItem Text="Blog" Value="Blog"></asp:MenuItem>
</Items>
</asp:Menu>
</strong></span>
<br />
<br />
Mobile image
<br />
</div>
</form>
</body>
</html>
I believe this is what you are trying to accomplish:
<body>
<table style="width: 100%">
<tr valign="middle">
<td colspan="2">
<span style="font-size: 16pt; font-family: Verdana">
<a href="http://www.wiltshire-mobile.com">
<img alt="Wiltshire mobile website logo" class="style3" src="Images/logo.PNG" /></a> <span class="style1"><strong style="text-align: left">
</span>
</td>
<td style="width: 80%">
</td>
</tr>
<tr valign="top">
<td style="width: 20%">
<asp:Button ID="mysiteloginbutton1" runat="server" Text="My Site Login" BackColor="#FF9900" ForeColor="White" Style="text-align: right" /> <span class="style1"><strong style="text-align: left">Sign up | Help |<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
<asp:ListItem>English</asp:ListItem>
<asp:ListItem>Bangla</asp:ListItem>
</asp:DropDownList>
</td>
<td style="width: 80%">
<asp:Menu ID="Menu1" runat="server" StaticSubMenuIndent="16px">
<Items>
<asp:MenuItem Text="Home" Value="Home"></asp:MenuItem>
<asp:MenuItem Text="Features" Value="Features"></asp:MenuItem>
<asp:MenuItem Text="Tour" Value="Tour"></asp:MenuItem>
<asp:MenuItem Text="Plans" Value="Plans"></asp:MenuItem>
<asp:MenuItem Text="Blog" Value="Blog"></asp:MenuItem>
</Items>
</asp:Menu>
<br />
<br />
#RenderBody
<br />
</td>
</tr>
</table>
</body>
Now, I added '#RenderBody', as this should be used as your "_LayoutPage" and then each page calls to this to show how it should be designed.
The basic concept is to design the site as a table and then separate each element into columns and rows of that table, as I did here. <td> and <tr> are used to separate these items.
If you wanted to go more into how things looked, you should have this page point to your site.css file. The css file should contain everything as it is regarded to positioning of text, color, layout for specific items (such as tables), etc. Hope this helps.

Align asp:Button above first column of the gridview below

I have a styling problem
I am trying to align a button with the first column of a gridview which is right underneath.
Something like this:
I've done the following but obviously it will fail with different resolutions:
<div class="formsFormBlock">
<asp:Label ID="LblRecurError" runat="server" />
<div style="text-align: left; position: relative; left: -15%;">
<table style="border: 0">
<tr>
<td style="border: 0">
<asp:Button ID="btnRecur" runat="server" Text="Repeat" />
</td>
</tr>
</table>
</div>
<asp:GridView>
</asp:GridView>
How can i do this?
Addition:
the gridview doesn't have a cssclass but the div above has the following css attributes:
.formsFormBlock{clear:both;position:relative;border-bottom:1px solid #e8f1f7;padding:0.53em 0.83em}
.formsFormBlock .formsItemLabel{display:block;width:25%;float:left;position:relative}
.formsFormBlock .formsItemLabel em{position:absolute;/*right:1.66em*/color:#ff0000}
.formsFormBlock .formsFormBlockHint{color:#999;font-size:92%;}
#formsFormHd:after, .formsFormBlock:after{content:".";display:block;height:0;clear:both;visibility:hidden;}
#formsFormHd, .formsFormBlock{display:block;clear:both;}
*:first-child+html #formsFormHd, *:first-child+html .formsFormBlock{display:inline-block;}
Try this
<div class="formsFormBlock">
<div style="text-align: left; position: relative; left: -15%;">
<table style="border: 0">
<tr>
<td style="border: 0">
<asp:Button ID="btnRecur" runat="server" Text="Repeat" />
<asp:Label ID="LblRecurError" runat="server" />
</td>
</tr>
</table>
</div>
<asp:GridView>
</asp:GridView>
<div id="container">
<div style="float: left; margin-bottom: 10px;">
<asp:Label ID="LblRecurError" runat="server" />
<br />
<asp:Button ID="btnRecur" runat="server" Text="Repeat" />
</div>
<div style="clear: left;">
<asp:GridView runat="server">
</asp:GridView>
</div>
</div>
cheers

HTML center works on server but not on local machine

I'm experiencing some weird behaviour on my local machine, when I access a page on my test server everything is centered like I want. When I run the code on my local machine everything is left aligned, the centering is ignored.
The HTML is really simple so I don't see why this issue has suddenly started to happen.
<table>
<tr>
<td>
<asp:HyperLink NavigateUrl="" ID="hlPhoto" runat="server"><asp:Image ID="imgPhoto" runat="server" ImageUrl='<%# String.Format( "../images/mugshots/{0}", DataBinder.Eval(Container.DataItem,"Photo") )%>' /></asp:HyperLink>
</td>
</tr>
<tr>
<td valign="bottom" align="center">
<div>
<b>
<asp:Label ID="lblName" runat="server"><%# Eval("FullName")%></asp:Label></b> </div>
<div>
<asp:Label ID="Label1" runat="server"><%# Eval("Jobtitle")%></asp:Label></div>
<div>
<br />
<asp:HyperLink NavigateUrl="" ID="hlDetail" runat="server"><font size="2">Details</font></asp:HyperLink>
</div>
<div>
<asp:HiddenField ID="userID" runat="server" Value='<%# Eval("Jobtitle")%>' />
</div>
</td>