.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

I want 404 instead of redirecting to login page

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :ASP.Net
I have implemented the standard Login control and everything works fine.However when i enter an invalid URL it gets redirected to the Login page.e.g. http://www.mywebsite.com/xxx gives a 404but http://www.mywebsite.com/xxx.aspx causes a redirect to the login pageI am using ASP.NET 3.5 on Windows Server 2008.I have set up the web.config with the following<customErrors mode="RemoteOnly" defaultRedirect="/Unauthenticated/GenericErrorPage.htm"> <error statusCode="403" redirect="/Unauthenticated/NoAccess.htm" /> <error statusCode="404" redirect="/Unauthenticated/FileNotFound.htm" /> <error statusCode="500" redirect="/Unauthenticated/FileNotFound.htm" /></customErrors>and also<httpErrors existingResponse="Replace"> <remove statusCode="403" /> <remove statusCode="404" /> <remove statusCode="500" /> <error statusCode="403" path="/Unauthenticated/NoAccess.htm" responseMode="Redirect" /> <error statusCode="404" path="/Unauthenticated/FileNotFound.htm" responseMode="Redirect" /> <error statusCode="500" path="/Unauthenticated/FileNotFound.htm" responseMode="Redirect"

View Complete Post

More Related Resource Links

Redirecting to login page while accessing document from document library In FBA Authentication

Hi all,            I have FBA site. When i open document from share point document library, it takes me to login page. After i enter credentials it will open page in client application ( ex. Microsoft word, microsoft powerpoint).   Regards Milan chauhan

Need help redirecting users to personalized page


 Hi, first timer here so be gentle.


I've been able to create a cool little website, it's up and running with users logging in and out, I created roles so my administrative team can see sensitive data that's not available to regular and anonymous users.

Now they would like me to create a page specific to each user.  For instance when user A logs in they are redirected to a page that has information that pertains to user A only (like a list of their benefits/ their remaining vacation time). This page needs to be accessible only to user A. 

I've watched a ton of the videos but have yet to see one that covers this topic, any help would be great!!!





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

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";

After login redirect to a desired page

Hi,   Just a simple question. After I click login button, I want to page be redirected to display.aspx. How to set up it? Sorry for the silly question.

dynamic menu control call in login page

Hi ,i have declared two control in my master page , how wants to call this menu control in child page ( that is login page)i want to bind the menu control dynamically based on login previlagepublic Menu newMenu = new Menu();  public MenuItem newItem = new MenuItem("Master");

HttpWebRequest Form Authentication Not Getting Past Login Page

Hey Guys,I am trying to use HTTPWebRequest to login to a site and then retrieve the page after login. However, it seems as if I can't get past the login. I also investigated with Fiddler and tried mimicking Fiddler almost completely and still no luck.Any idea what I am doing wrong?Thanks,Mohammed    Dim webRequest As HttpWebRequest Dim responseReader As StreamReader Dim responseData As String Dim postData As String = "login=testexpert@yahoo.com&password=testexpert" Dim cookies As CookieContainer = New CookieContainer() Dim requestWriter As StreamWriter Try 'post form data to page strUrl = "https://www.ideeli.com/login" webRequest = HttpWebRequest.Create(strUrl) webRequest.Method = WebRequestMethods.Http.Post webRequest.ContentType = "application/x-www-form-urlencoded" webRequest.CookieContainer = cookies webRequest.ContentLength = postData.Length requestWriter = New StreamWriter(webRequest.GetRequestStream) requestWriter.Write(postData) requestWriter.Close() 'recieve cookie webRequest.GetResponse().Close() 'now we send the cookie webRequest = HttpWebRequest.Create("http://www.ideeli.com") webRequest.CookieContainer = cookies responseReader = New StreamReader(webRequest.GetResponse.GetResponseStream()) responseData = responseReader.ReadToEnd() res

Authentication required, redirect to login page

Hi,I want authentication required for all webpages in a site. If i copy the url of any of the web page in the current site and paste it in the url address i should redirect to login page. If you have any solution please suggest it.

Redirecting to custom page while clicking on the user/group browse button

Hi, i have created a custom visual web part in visual studio 2010 and i deployed it into sharepoint site by creating a new page in my site. The custom page gets the data of users/groups from database and pass the users to the people picker in sharepoint.Here my question i have a document library where we upload document and get the users page popup that consists of people picker and a user/group browse button.when i click on the (book image button)browse button it will redirect to the user and group search page but here i need to replace my custom  user/group search page with the default one so please help me how to redirect to the custom page by clicking on the user/group browse button,and i need to pass the selected users to the people picker text box........please give me some solution whether this can be done or not if possibe please send me the link or some sample code how to do this   thank you.

need a simple login page cus my hosting provider system wont allow me to have more than one database

I dont really write html code too well  but I manged to get my web site developed and deployed using the built in features such as drag n drop, master page and user account authentication that make web developing almost a codeless experience. However; my hosting provider system wont allow me to have more than one database, this causes problems becasue when I developed my web app using vb2010 web developer (asp.net v2) I used the built in web config tool to manage users for my site, now after I deployed to my domain it all worked ok with the exeption of the login page, when I tried to log in the system threw a error message saying "database not found." or a page of "gobble-dee-gook" that says the same thing When I contacted support (my hosting provider) they said i have to create a table of users in my database file via 2008 sql server, thats ok I can do that, but my real problem is I dont know how to write appropriate code to reference the table. So heres my problem:  I just want to have some kind of login page with a couple of txtboxes and a click button that maybe using the VB code behind or html checks the input variables "username" "password" against something that is hard coded into vb a string variable or a constant and then branches to Mainmenu.aspx if successfull. I just need it real simple, no fancy stuff just a login s

how to redirect user to login page if session is null

i have 2 page,1.login.aspx ---  2.welcome.aspxin my login.aspx im storing username into sesssion as below:Session["usernm"] = txtUsername.Text;in my welcome.aspx  pagein page_load event if (Session["usernm"]==null)        {            Response.Redirect("Login.aspx");        }----- here if i manulally paste the url ( http://localhost:4125/Loginado/welcome.aspx) it should go to  login.aspx for user credentialsbut its going directly to welcome.aspx  page.

How do I allow some .net pages to be used from a login page before the user is authenticated?

Ok, I have a .net homepage (viewable and useable to everyone) which is "login.aspx".  There is a header with a menu and three columns under that.  The header has a "home" button which will display a page (standings.aspx) with data from a gridview control which gets its data from an access db in a directory called Access_DB from the root level of the site. The next menu in the header is "Schedules", which uses the same db and a set of .aspx files (i.g. MondaySched.aspx, ThursdaySched.aspx, etc) to populate NFL schedules in various formats, and the last column "About" is just some html files.  All of this data is placed in an IFRAME in the middle column of the page.  The left column is where the login textboxes/submit button reside, the last column is just some html.I am using form level authentication as follows:<authentication mode="forms"><forms name="BTGAppSec" loginUrl="login.aspx" protection="All" timeout="30" path="/" /></authentication><authorization><deny users="?" /></authorization>The problem is when you go to the site and it tries to load the "standings.aspx" into the IFRAME on page load, it sees that as an unauthorized user and sends the IFRAME back to login.aspx.  So what you get is a &qu

Writing a login page that checks against AD Credentials

Hey everyone: Just a quick question hopefully someone can help me out with.  I'm trying to write a simple login page, that will allow my users to login to my site using their Active Directory credentials (using their username / password we give them through AD).  I want to do 2 things with the login: 1. I want to check the username / password against our AD and verify the person is a valid user within the directory. 2. I also want to store the entry within a global variable so when the user fills out one of the forms within the site it can Insert the data into a SQL table i have running.  ** we are using this site to do Setup Change Request Forms / Termination forms etc. and I just want to verify the person signing off on the form is the person logged into the machine -- use it as an "electronic signature per say". I'm using a vb.net 2.0 approach - as i only have access to visual studio 2005 and i'm more of a vb programmer then a c#. If anyone has any examples or can walk me through how to go about writing out this page that would be great.  Thanks everyone - the help is appriciated in advance.  Best regards, Ryan 

Redirect to Login Page from Generic Handler

Hi,I have created a asp.net generic handler to use it in auto-complete text box. Here is my code to it /// <summary>     /// Summary description for $codebehindclassname$     /// </summary>     [WebService(Namespace = "http://tempuri.org/")]     [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]     public class ProductSearch : IHttpHandler, IReadOnlySessionState     {         public void ProcessRequest(HttpContext context)         {             String query = context.Request.QueryString["q"];             if (! string.IsNullOrEmpty(query))             {                 int sid =  Convert.ToInt32(HttpContext.Current.Session["ScenarioID"]);                 int evId =  Convert.ToInt32(HttpContext.Current.Session["EventID"]);                 var products = from p in Data.BO.Product.GetScenarioProducts(sid, evId, query) select new { id = p.ID, name = p.Name };                &nbs

UrlAuthorizationModule from login page screen

Hi All,I am new in ASP.NET, i need to learn how i can perform the windows login using custom made login form?For the example i have page login.aspx where i have textbox control for UserName and Password. and our Intranet client need to put his Username and Password and click Login button. the credential should be check against the windows basse authorization. If correct he will be redirected to the main page according to the roles defined in his windows account.I will appriciate for link of tutorial or easy way to do this job.Thank You,

Form based authentication Sharepoint 2007 gets redirected to login page

Hi We have sharepoint 2007 site deployed on Windows server 2008, IIS 7.0.  We extended the web application to enable forms based authentication referring to link http://msdn.microsoft.com/en-us/library/bb975136(office.12).aspx#MOSS2007FBAPart1_Intro, we selected Kerberos instead of NTLM, behavior is like, when user tries to login into the site using OOB login.aspx, user again gets redirected to the login page. We tried to extend the web application again but this time we selected NTLM, but this time farm account (also is application pool identity) is not able login and exhibits same behavior as above, but for other users we are able to login. Has anyone come across this behavior? can anyone please guide me in correct the behavior? Regards, RK  Radhakrishna
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