.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Creating Login Page Problem

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :ASP.Net
I doing a login page using visual c# and encounter some problem on it. my database got Username, Password, and UserType I want to create a login page redirect the user to different page based on their roles. It show that there is an error on the code (line 24). Any idea on create a login page that redirect the user to different page based on their roles?It shows this message :   this type or namespace name 'DataView' could not be found(are you missing a using directive or an assembly reference)Here the code, protected void Page_Load(object sender, EventArgs e) { string connectionString = "Data Source =.\\SQLEXPRESS;" + "AttachDbFilename=\"C:\\Program Files\\Microsoft SQL Server\\MSSQL10.SQLEXPRESS\\MSSQL\\DATA\\UserDB.mdf\";" + "Integrated Security=True;" + "Connect Timeout=30;" + "User Instance=True;"; System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(connectionString ); System.Data.SqlClient.SqlCommand cmd = conn.CreateCommand(); conn.Open(); } protected void Button1_Click(object sender, EventArgs e) { SqlDataSource sds = new SqlDataSource(); sds.SelectParameters.Add("Username", TypeCode.String, this.TextBox1.Text); sds.

View Complete Post

More Related Resource Links

Forms Based Authentication - problem with custom master page and login page



I have successfully enabled and set up FBA (Forms Based Authentication) on my SharePoint 2010 Foundation server. The thing is that I need to customize the look and feel of the login page. I have successfully customized the page (and master page) to look the way I want, however, when I try to log in, I get the following error/message on the page:
"Forms Based Authentication on classic Web applications has been deprecated".

What I've done:
Made copies of /_layouts/simple.master and /_layouts/login.aspx and renamed the copies. The markup in the master page is MUCH simpler than the original, but I've kept all the ContentPlaceholders that I don't use (most of them) in a hidden <asp:Panel at the bottom of the page.

I've changed the web.config file:
<authentication mode="Forms">
      <forms loginUrl="/_layouts/loginCustom.aspx" />

So, I'm not getting any errors on the page until I try to log in. When I use the default settings (login.aspx and simple.master) it works just fine (but damn that page looks ugly!).

Does anyone know what I might be missing?

Update: I believe the reason it doesn't work is because my custom login aspx is not part of the Claims Based Web Application (because it's sitting

Problem re-creating web part page



I've got some web part pages which are being setup programatically. I want to be able to refresh those pages, i.e. delete all webpart on them and recreate the content from scratch. When I try this, the following exception is thrown:

The transformer type "Microsoft.SharePoint.Portal.WebControls.TransformableFilterValuesToEntityInstanceTransformer" is not allowed to be used on this page.

The exception comes from the following line:

SPWebPartConnection newConnection = wpmngr.SPConnectWebParts(providerWebPart, providerConnection, consumerWebPart, consumerConnection, transformer);

So I thought "let's delete the page and then just recreate it". Doesn't work either, same exception is thrown. I have no idea why this code would work the first time, but doesn't work a second time. It seems like something get's stuck preventing the same action twice, but I have no clue what to look for.

MCTS in Web Application Development in .NET 2.0

"403 forbidden" Error in my Custom login page, cant find problem

I Created a custom login page using Sharepoint Application page which is cofigured with FBA.  but every time redirect to http://testsp.max-perf.com/_layouts/DataQ.Extranet/test.aspx?ReturnUrl=%2f_layouts%2fAuthenticate.aspx%3fSource%3d%252F&Source=%2F .  I have  Win2008 (not r2) and sp2010. Thank you.

login page problem



In login.aspx I have used login control to enter user name and password, the problem is: even my caps lock is off when I enter user name it prints in capital letters but size is small size (when I copy and paste in note pad or msword it paste in small letters not in capital letters), when I turn on my caps lock on and type - it prints in bigger size as if I am typing in capital letters.  

ex:  1. temp is my user name if my caps lock is off it shows like this TEMP (but size in smaller than 2nd one)

       2. if my caps lock is on is shows like this as if I am typing capital letters TEMP

what do you think the problem is how can I fix it?



Web application conversion / login page problem


Hi guys,

I have converted a web site project in a web application project in VS 2010. The web site worked fine but now I've got a problem with my login page. When the page is loading it loads some images, javascript, css files and for all of them requests are redirected to the login page again and that triggers the same files to be loaded again which redirects them to the login page and so on. An infinite loop.   

As far as I understand the problem is ASP.NET_SessionId cookie is not set. However I cannot figure out why. The web.config file is the same. If I setup a web site under my local IIS to point to the project folder the site works fine.

The web.config was not changed. I tried to compare it with a web.config of a newly created web app and I do not see much difference.

Here is a part of my web.config

		<authentication mode="Forms">
			<forms name=".ASPXAUTH" loginUrl="~/login.aspx" defaultUrl="~/default.aspx" slidingExpiration="true"/>
			<deny users="?"/>
		<compilation debug="true" targetFramework="4.0">
				<add assembly="Microsoft.Transactions

Problem on focus when creating a Publishing Page



when i try to create a publishing page on sharepoint site i have the cusor focus on content but my problem that i want to focus the cursor on the title of the page so i tried to make that with javascript so i ve tried with

<body onload="DoAfterPageLoad()"> and the event ready() using jQuerry but it does not work so how do i change on sharepoint 2010 the creation of new publishing page to focus the cursor on the title after the creation of the page

WebDev.WebServer.exe has encounted a problem and needs to close when trying to view page in browser


Hi, whenever I load an aspx page in vwde2008, I get the message in the subject of this post.  After I click Ok on that, I get a dialog box, Unable to Connect to the ASP.Net development center.  What can I do to troubleshoot?

I am using Windows XP SP3, vwde2008 with SP1, on a HP desktop.  Also using Office 2003 if that is relevant at all.

Thanks, Justin

page postback problem with crystal report


Hi , i am creating crystal report with asp.net it is working showing data but  data is of two page its is take round trip action but report is not show 
until again i click on show button in this it is not propersly showing that data is how.

<br />
    <asp:Button ID="btnShow" runat="server" OnClick="btnShow_Click" Text="Show Report" />
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" DisplayGroupTree="False" EnableDatabaseLogonPrompt="False" /> CrystalReportViewer1.ReportSource = null; SqlCommand cmd = new SqlCommand(strcmd, c.con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); ReportDocument doc = new ReportDocument(); doc.Load(AppDomain.CurrentDomain.BaseDirectory + "\\rptQuotation.rpt"); doc.SetDataSource(ds.Tables[0]); // login info SqlConnectionStringBuilder csb = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["conStr"].ConnectionString); TableLogOnInfos crtableLogoninfos = new TableLogOnInfos(); TableLogOnInfo crtableLogoninfo = new Tabl

Login page for whole site


Hi all,


I've been searching and trying to get this now for hours, so i though i'd come here.

For my website, there will be an admin site. I want to create users in my website database, i have a logins table with a hashed password column. The problem i have is making sure that every request if not already logged in send the user to the login page.


I have a page Login.aspx which i have created, but if i enter http://website/admin/news.aspx it bypasses the login screen and shows the page!!


Does anyone know how i can do this? i have created Login.aspx myself and verified that the username and password enetered are correct.




I want to create registration page and login page


I have design form layouts for signup and login pages 

Please provide me the step by step code for sign up and login pages using c# with validation.

waiting for urgent reply

creating different sub page design template in sharepoint website


I know very little about sharepoint and have outsourced the design of a master page and sub page design for a new website using sharepoint. i received a site master file with all of the necessary images and the home page works just fine. However the file i received for the sub page design template was an ASPX file with the following instructions:


Here I enclosed the inner page layout file. You upload this file by using following instructions. you can change & edit the blue menu section in the master page itself. If I change into modifiable section you need to add the menu in each and every page, otherwise it will show as empty block. Please let me know your comments.


Steps for uploading inner page layout page.


1.Select the Site Actions button and click on Site Settings->Modify All site settings

Problem with master page and update panel (I think)



the app I am working with is made up of three nested master pages that have the following design:

The first master page ha only realize the HEADER, BODY and FOOTER divs.

The second one specialize the Body content placeholder and divide it in three more layers: NAVIGATOR, PAGE TITLE, BODY CONTENT.

The final layer specialize the BODY CONTENT in PAGE CONTENT and ACTIONS.

In one of my content pages I have (inside the PAGE CONTENT area) 

  • 1 Update Panel that contains a gridview object
  • 1 Update Panel that contains some HTML code to show in a PopupModalExtender

The PopupModalExtender can be either triggered from inside the gridView and also from a series of LinkButtons that are in the ACTIONS area.

The problem is that when the PopupModalExtender shows the FOOTER and the ACTIONS areas are not dimmed from the style I apply as background to the modal popup. An example of what I am trying to explain can be viewed in the following screenshot.

Why this is going to happen? Has anybody any suggestion on how to solve this problem?

Thanks a lot

Problem when I back to page


Hi Friends

I have page A.aspx where I show some result in listview. When I click On Some data on listview I go to page B.aspx.

Now the problem is when I click on back in page B.aspx it comes to A.aspx with out previous listview result. Ack requirement is when I come to page A.aspx result of listview has to be there. How do i do that?

Could u please help me out?



CSS Problem on ASPX page


I am having a problem with space around a div. The page looks perfect in the VS internal browser, but there is space at the top between the body and the div for the page layout in IE and FireFox. I tried everything I know by setting margins to 0 and padding to 0 for the body, div, form, almost everything and there is still space. The wierd thing is that the space shows the background color when I set the padding for the div#page to 0, and the space is the div#page background color when the padding is set to a value.

I must be missing something. I looked at the page's HTML after it is rendered from the server and it inserts a dive with a hidden control for the viewstate. I thought this might be causing the problem so I set the margin and padding for all divs to 0, but it did nothing.

The code for the simple page and CSS is provided below.

It appears the problem disappears and the page looks as I intended when I use the Compatibility View in IE8.

Thanks for the help in advance,
-- Chris



<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="CSSDemo1.aspx.vb" Inherits="Web.CSSDemo1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/

Login Page



I am doing my first project in .net and i have doubts with the creartion of the login page. I have writteh the code..But i am not able to acess from the data base based on the username and password enteres.

Can someone help me on this please?












dr= cmd.ExecuteReader();





boolReturnValue =




















bool boolReturnValue = false;string str ="Data Source=.;Initial Catalog=AgileTool;Integrated Security=True";

Problem while creating process memory dumps.

Hi, I have following piece of code: Imports System Imports System.IO Imports System.Runtime.InteropServices Imports Microsoft.Win32.SafeHandles Imports System.ComponentModel Module Module1 <Flags()> Friend Enum NativeMiniDumpType MiniDumpNormal = &H0 MiniDumpWithDataSegs = &H1 MiniDumpWithFullMemory = &H2 MiniDumpWithHandleData = &H4 MiniDumpFilterMemory = &H8 MiniDumpScanMemory = &H10 MiniDumpWithUnloadedModules = &H20 MiniDumpWithIndirectlyReferencedMemory = &H4 MiniDumpFilterModulePaths = &H80 MiniDumpWithProcessThreadData = &H100 MiniDumpWithPrivateReadWriteMemory = &H200 MiniDumpWithoutOptionalData = &H400 MiniDumpWithFullMemoryInfo = &H800 MiniDumpWithThreadInfo = &H1000 MiniDumpWithCodeSegs = &H2000 MiniDumpWithoutAuxiliaryState = &H4000 MiniDumpWithFullAuxiliaryState = &H8000 End Enum <DllImport("dbghelp.dll", CharSet:=CharSet.Auto, SetLastError:=True)> Friend Function MiniDumpWriteDump(ByVal hProcess As IntPtr, ByVal processId As Int32, ByVal hFile As SafeFileHandle, ByVal dumpType As NativeMiniDumpType, ByVal exceptionParam As IntPtr, ByVal userStreamParam As IntPtr,

Help!, Problem with creating my store procedure.

I have two tables. Product_Table with ProductID as the primary key. My other table, ProductSKU_Table which has SKU as the primary key and ProductID as the foreign key. I am trying to create a store procedure to insert into both tables. How do I insert the primary key from the Product_Table into the foreign key of the ProductSKU_Table? This is what I have so far:ALTER PROCEDURE [dbo].[sp_addNewProduct] ( @productName varchar(50) = null, @shortDescription varchar(100) = null, @longDescription varchar(4000) = null, @active bit = null, @category int = null, @sku varchar(11), @skuDescription varchar(200) = null, @orginalPrice money = null, @sellingPrice money = null, @specialPrice money = null, @qtyOnHand int = null, @qtyAtSupplier int = null, @imagePath varchar(200) = null, @releaseDate datetime ) AS BEGIN DECLARE @lastIDInserted int INSERT INTO Product_Table(Name, ShortDescription, LongDescription, Active, CategoryId) VALUES(@productName, @shortDescription, @longDescription, @active, @category) SET @lastIDInserted = @@IDENTITY INSERT INTO ProductSKU_Table(ProductId, SKU, Description, OrginalPrice, SellingPrice, SpecialPrice, QtyOnHand, QtyAtSupplier, ReleaseDate, imagePath, CreatedDate, ModifiedDate) VALUES(@lastIDInserted, @sku, @skuDescription, @orginalPrice, @sellingPrice, @specialP
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend