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

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

Return to the wrong web page.

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :ASP.Net
Hi, In my web site, I have master page, default.aspx, login.aspx,loggedout.aspx and Display.aspx. default.aspx is the start-up web page. I want to go to display.aspx after I login. However it always go to default.aspx. Here is the code. login.aspx<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %> <asp:Content ID="Content" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:Login ID="Login1" runat="server" onauthenticate="Login1_Authenticate"> </asp:Login> </asp:Content>     login.aspx.csusing System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; public partial class Login : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { string userName = Login1.UserName; string password = Login1.Password; bool rememberUserName = L

View Complete Post

More Related Resource Links

How to return back to a specific page in a gridview list?

Hello,  I have a gridview with paging. So for instance, I'm on say the page number 10, and I open the form details on a specific record_id (link). After I update/submit the form, it returns to page number 10. But, if I go to another page, for instance page 5, and submit the form, it returns to page 10. I've tried some things, for instance history.back(), but it returns to the first page I went to, in this case page number 10 (or whatever the first page I go to). Hopefully this code helps to understand what I'm asking: <asp:GridView DataKeyNames="Referral ID" ID="gvList" runat="server" CellPadding="4"     ForeColor="#333333" GridLines="None" OnRowCommand="gvList_RowCommand"     OnRowDataBound="gvList_RowDataBound" OnRowDeleted="gvList_RowDeleted"     OnRowDeleting="gvList_RowDeleting" AllowPaging="True" PageSize="20"     AutoGenerateColumns="False" OnPageIndexChanging="gvList_PageIndexChanging"    OnRowCreated="OnRowCreated" AllowSorting="True" OnSorting="OnSort"> protected void gvList_PageIndexChanging(object sender, GridViewPageEventArgs e)        {   &nb

Log in givin wrong destination page

I have a log in control that has this set in the aspx:      DestinationPageUrl="~/Admin/Articles/ListArticles.aspx"      DestinationPageUrl="~/Admin/Articles/ListArticles.aspx" This works well when i log in. But when i log out and im returned to the log in page the url shows:Finlandsinstitutet/login.aspx?ReturnUrl=/Finlandsinstitutet/Admin/Articles/Default.Aspxand since there is no default.aspx in the articles folder i cannot log in again!Why is this?

return url in aspx refreshes the page when I click login after entering user name and password

Hello,   I need help as I am struggling to login into my web portal on my new sony vaio laptop. I think that I need to do some settings, or download some plugin. Infact I don't know what to do, as I have spent many hours trying to login, but no success. Below is my office website:   http://www.lantec-uk.net/SignIn.aspx?ReturnUrl=%2fdefault.aspx When I enter my credentials and click login, the web page gets refreshed, i.e username and password get erased, rather than taking me into my web-portal. The laptop is having windows 7 home premium, with ie8. I have also tried installing firefox, chrome, opera and safari, but same problem. Somebody please help, as sony has refused to take the laptop back and they are saying that there is problem with website. Similarly, website staff are saying that there is a problem with the laptop and not with the website.   Any help highly appreciated. 

ASP.net Web Site Administration Tool. An error was encountered. Please return to the previous page a

I have just installed Visual Studio 2010 trial. Previously I have been using Visual Studio Web Developer 2010 Express. Now every time I try to invoke the ASP.net Cofiguration tool either via the icon or through the Project File Menu item, I get the error message "An error was encountered. Please return to the previous page and try again." I am trying to develop a bog standard Silverlight Business Application. There are no other diagnostics. Is there anywhere I can look for more clues or anything else to do to alleviate the problem? or is this something peculiar to the trial version I am using?   I also think it might have something to do with the fact that I have created this Silverlight Business App on a directory on my D: drive and not the normal, default c: drive path and maybe the web sit admin tool is looking somewhere else. Could this have something to do with it? If so what is my remedy?   Help please.....

Retrieve Previous State Data on return from another page


I have a list page having date in repeater control. And also having some search criteria on the page. Using that I filter the data on the page. Now in repeater I have Edit button. Which allows me to open that record details in another page.
When I come back to list after saving or cancel, the filtered data is gone. I want to keep that filtered record with selected values in filter controls (checkbox, dropdown etc).
I have two options in my mind 1) Session, 2)

I have my insert logic in my class, how do i output the return value on my page to use with another


I have the following portion in my class, i need to get the value of the inserted record so i can use in another insert that im doing with a loop, so i need to add another variable to my

"public void insertServ( string EmLogin, string EmPass, int Emnum )"  the procedure is already returning the value i need, just need to get it back on the page so i can use it with my next insert.



                cmd.Parameters.Add("@EmLogin", System.Data.SqlDbType.VarChar).Value = EmLogin;
                cmd.Parameters.Add("@EmPass", System.Data.SqlDbType.VarChar).Value = EmPass;
                cmd.Parameters.Add("@EmNum", System.Data.SqlDbType.Int).Value = EmNum;

                cmd.Parameters["id"].Direction = ParameterDirection.ReturnValue;

            catch (System.Data.SqlClient.SqlException ex)
                string msg = "Server Email Insert Error:";
                msg += ex.Message;
                throw new Exception(msg);


return asp.net page contents from a restful function !


hi , 

i want to make restful function that sometime return html or javascript or anything but sets the ContentType appropriatly , thus clients processes the return contents depending on the return type.

now , i have an asp.net page , and i want to run the page internally , what ever is returned from the asp.net page (the html), i want it to sent it to the client setting it's return type to html. i am stuck at this point . i.e how do i process the asp.net page internally , get the return contents (html), and return the html from the rest ful function.



Exporting data that is in wrong code page in SQL Server



I have problem, when tryin to export data from SQL Server 2005 using Integration Services.

Sql Server has collation SQL_Latin1_General_CP1_CI_AS (code page 1252), but the actual data is encoded using code page 1257 (SQL_Latin1_General_CP1257_CI_AS). When I look the data using Management Studio, it is displayed wrongly, but when I convert the string to binary, I can see that bytes are encoded using code page 1257. I'm trying to read this data using SSIS 2005, but extended characters are always handled wrongly.

How should I read this data using SSIS?

My first assumption was changing DefaultCodePage to 1257 in my OLE DB Source component (also AlwaysUseDefaultCodePage to true). But without luck.

Also tried to convert data in my SQL Server query using COLLATE, but didn't work.

Is there something I could do to get it working?



Return to top of page during form validation


I have a asp.net form that is vaildating required fields. The validation is working fine EXCEPT when I click the submit button the form stays on the bottom of the page. I need the code for on focus to the first invalid field.

cross page posting values getting wrong



I  am doing project in asp.net(3.5),c#.net and sqlserver2005

I am using cross page posting property from reviewsubmit.aspx page to principalauthentication.aspx,

and to get the values to other page i am  using get propery, here the problem is when i am posting details to other page from there i am submitting to db. if both users logged in at a time and   submitted, second submitted user previouspage values coming as first submitted previous

page values. what should i do, how can i resolve

please give me solution.

Return to default page


When I reach the last page on my site, I want the user to go back to the original default (home Page).

This is the code I have now and itis not working.

<form name="FormH" method="Post" action="http://www.canutilloisd.org">

I thought this was simple, but I cannot return to our home page, it tells me that the page was not found.


Does anyone know what I am doind wrong?

Thanks in advance





HTTPCONTEXT return null in a DLL in a sharepoint 2010 custom application page?


am having a application page abc.cs file in a class library and abc.aspx in the _forms folder of 14\template  in sharepoint 2010 env.

also i am having another DLL[ say xyz] which  has  2 classes  and some methods.

now i am accessing a  website page with a  querystring http://servername:4444/hoem.aspx?sid=5353535dsadsaddada

I want to get this query string in the abc's onload event and adding it to the http cookie. Now my reqmnt is i want to access the query string using httpcontext.current.request.querstring["sid"]in the second DLL [xyz].

when  tried to access the request.querystring() thr HTTPCONTEXT throws/returns  NULL .

i wonder, why this httpcontext returns null.

how can i access the querystring().

any help is appreciated



Changing the graphics on the home page of a SharePoint site

When you create a site in Microsoft Windows SharePoint Services by using the default Team Site template, the home page includes two default graphics. A Windows SharePoint Services graphic appears in the body of the page, and a picture of a house in a circle appears near the site title. You can change these graphics to customize your site. Changing the smaller graphic requires a Windows SharePoint Services compatible Web page editor

Using jQuery to directly call ASP.NET AJAX page methods

Here I am looking to explain how to call page methods using jQuery. Using jQuery to directly call ASP.NET AJAX page methods

Reduce ASP.NET Page size and complexity using JQuery

This is my first post on asp.net blog. ASP.NET Ajax and JQuery are two different ajax framework. In this post I will show, how we can enhance gridview using ASP.NET Ajax and JQuery. I also compare the implementation of these frameworks. In next posts i will explain more about JQuery and ASP.NET Ajax and also tell you "How to combine the power of both framework". My Future post will related to ASP.NET and related frameworks.


I have 2 web pages. First page has a textbox and a button control.

when I enter test and click on the button , system goes to the second page. And in the second page I want to access the Textbox in the first page. When I try to do this I get the following error.

"Object reference not set to an instance of an object. Following is my code :

Dim txt As New TextBox

' Find the server name on the previous page
txt = CType(Page.PreviousPage.FindControl("TextBox2"), TextBox)
If Not IsNothing(txt) Then
Response.Write("[Name Not available]")
End If

I know I could do this with session, but I want to use the Page.PreviousPage.FindControl. Any help is greatly appreciated

Unique content within master page based on conditions met


 Hi all-

I would like to present users with unique content based on certain conditions being met as they land on the home page (default.aspx).  The condition logic will be in the VB code behind Page Load event. The content will go in a content placeholder as specificed from the master page. 

However, the content change wouldn't be something small (ie making a panel or label visible or not) but rather it will be different HTML,  Divs and databound gridview content.  The HTML content will be stored in the database.

Can someone point me in the right direction for best practices on how to accomplish this?


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