.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

Which event of an httpmodule do i use to redirect a user after he is authenticated?

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :ASP.Net

I want my application to send the user to the page he last visited (stored in a cookie).

If i want to do this using an http module then in which event of the module should i do this?


View Complete Post

More Related Resource Links

dynamically change html code when user is authenticated


So I have a fairly simple web site which allows an Administrator to edit some data in a database which is displayed on some web pages.

The main navigation on the site is shown in the code snippet below. The Admin link goes to a Login.aspx which allows the Administrator to log in - once authenticated they get sent to the data edit page.

So my question is, how could I dynamically add a link to the data edit page in the <ul> list below once the user is authenticated ?

This would allow the authenticated user to see links to the secure pages in the main navigation bar.

<%--Top Navigation Menu --%>
<div id="topMenu">
<li><a href="default.aspx">Home</a></li>
<li><a href="introduction.aspx">Introduction</a></li>
<li><a href="curriculum.aspx">Curriculum</a></li>
<li><a href="times.aspx">Times & Fees</a></li>
<li><a href="staff.aspx">Staff</a></li>
<li><a href="login.aspx">Admin</a></li>
</div><%--End of topMenu Container--%>
<div id="clear"></div><%--Floats items cleared End of Master Page--%>

Knowing the event occured in user control in current page




      My web application has user control which uses third party controls called Devexpress controls. The user control is a menu  and is part of the Master page. It is placed there because this needs to be available in all the pages. My user controls raises a even on item clicked. Now, My question is that Is there any way to know that the event has occurred in page_load of the current page in which I am in?

want to launch modal Popup from created User Event handler




I have a create user wizard on my page and in the event handler (Created User) I get extra information from the user

via textboxes within the aspx etc.


I then do a response.redirect to another page.

What I want to happen is this


When the CreatedUser Event is fired, I  want a Modal Popup to show up with a message Processing your registration.

once the registration code is processed it will close and the users get redirected.


On my ASPX I have the Modal PopUp and a Panel.

In the code behind in the handler I put ModalPop.show()


but this does not work.


thanks for any suggestions



file upload in Create User Wizard Created User event with UpdatePanel Tag wont work?



In my Create User Wizard1 Created User Wizard Event, I am collecting extra information from text boxes and allowing

the user to uplad a file.



I have put the Submit button within an Update Panel Tag but since I have done this it does not work.

Is there a way round it. In this situation would you use a trigger.?


<br />

  <asp:UpdatePanel ID="UpdatePanel2" runat="server">

  <asp:Button ID="StepNextButton" runat="server"  CommandName="MoveNext"  align="middle"
                                            Text="Submit my Profile" />

HTTPModule Events not firing for non-administrative user

Hi All, I have deployed an HTTP module into the GAC on MOSS 2007 and Win 2k8. When I log in as administrator to the site, everything works fine. However, if I log-in as a non-administrative user (any other user) I can see the module registering but it does not fire. Anyone has any idea why this is so?   Cheers, Vikrant

AutoLogin for authenticated user via LiveID in Sharepoint 2010 (Claims Based Authentication)

Hi,     Im working in integrating LiveID authentication in my Sharepoint site. Live id gives back a token of the user with which i created a dummy profile using MembershipProvider.CreateUser. Now i have to auto login the user with the profile i created, i mean i have to force login to my sharepoint site using the created dummy user details without asking the user to give username n password.Any suggestion will be a great help for me to proceed.   Thanks Saravanan Michael

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

Redirect to specific page based on user Roles

I am using Formsauthentication. My situation is as per below:the login form has codebehind :==============================protected void LoginButton_Click(object sender, EventArgs e)        {            TextBox uname = Login1.FindControl("UserName") as TextBox;            TextBox pass = Login1.FindControl("Password") as TextBox;            CheckBox rm = Login1.FindControl("RememberMe") as CheckBox;            Literal fail = Login1.FindControl("Literal1") as Literal;            if (Membership.ValidateUser(uname.Text, pass.Text))            {                /                FormsAuthentication.SetAuthCookie(uname.Text, rm.Checked);                            }        &

Multiple instance of User Control on Page - Button Click Event

Hi, I have this Web User Control, with 3 controls:<asp:TextBox ID="txtSearch" runat="server" /> <asp:RequiredFieldValidator ID="rfvSearch" runat="server" ControlToValidate="txtSearch" Display="None" /> <asp:Button ID="btnSearch" runat="server" onclick="btnSearch_Click" /> In code behind: protected override void Render(HtmlTextWriter writer) { rfvSearch.ValidationGroup = this.ID + "_validation"; txtSearch.ValidationGroup = this.ID + "_validation"; btnSearch.ValidationGroup = this.ID + "_validation"; base.Render(writer); } protected void btnSearch_Click(object sender, EventArgs e) { Response.Redirect("ResultadoSearch.aspx?argumento=" + txtSearch.Text); } When I try to add two UserControl and I Click in btnSearch of second UserControl, txtSearch.txt returns value of first User control.How I can get the value of second txtSearch?

claims authenticated (FBA) user cannot open a connection to our custom application database

We have designed a custom sharepoint site. This site uses a membership provider that I implemented, and the users are stored in our custom application database. These are the steps I follow to reproduce the error: 1. Browse to our site. Select Forms Authentication from the default.aspx selection. 2. Enter in a username from our DB table. This user I have configured as a site collection administrator. 3. Login to the site. The user is authenticated by our membership provider and allowed access (ValidateUser returns true) 4. Browse to a page that attempts to connect to the custom app DB. 5. I get the following error when the page attempts to open a connection to our DB: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server NOTES: The code that opens the DB connection is running with SPSecurity.RunWithElevatedPrivileges. Our application pool account has access to the database. My user can connect to the database fine as well as the user that our  application pool is running as. I have validated the connection string that is being used in the debugger, and that is correct.

Can an authenticated user add items to a list anonymously?

I have a requirement to allow authenticated users to post items to a list anonymously. The SharePoint site is not enabled to allow anonymous access, so all users will be authenticated. Given that every item that is created in a list will have a Creator, is it possible therefore to impersonate another user? e.g. create an "Anonymous" account and somehow force all new items in a particular list to be created by this account. Perhaps the best way would be to write a WebPart whose UI contains the fields required and then programatically creates the list item as another user (using SPUserToken to get an SPSite object)? If there's a way to do it without code, I'd definitely be interested... Thanks, Alex

How to determine whether user initiated an event or the system?



I am going to be writing an application where I need to determine wether it was the user (by clicking on an comboboxitem for example) that initiated an event, or that is was the system(for example the selection of a combobox changes when a specific code executes or something like that) Could someone give me some pointers in the right direction here?

Thanks in advance

redirect only one user for that page



I have asp.net membership login in my asp.net application in that i have 30 users, What i need is

I have one xxxx.aspx page if user name 'John' is logged in then i need to redirect to that page xxxx.aspx and other user will not able logged in to that page except 'john'.. so let me know how to do this

Insufficient SQL database permissions for user '' Event ID 5214

I am getting the Database Error Event ID 5214, with the Source of Windows SharePoint Service 3 on my MOSS 2007 SP2 server - this system has been running for the past year fine & without this error.  The general text of the error in Event Viewer is:

Insufficient SQL database permissions for user '' in database 'SharePoint_Config' on SQL Server instance 'illinois'. Additional error information from SQL Server is included below.

The EXECUTE permission was denied on the object 'proc_getObjectsByClass', database 'SharePoint_Config', schema 'dbo'.

Notice that there IS NO USER listed.  I can only find articles dealing with setting the proper user permissions etc...but nothing about this.  Why would no user be listed here & where do I go to fix this?  Why would this error start occurring?

How to automatically Authenticate User on External Site once Authenticated on SharePoint Site


We analyzing the implementations approach, for a scenario.

  1. External Site: To log-in to external site which has its own user store and is hosted on different domain. So user has to provide his user id and password for logging in to external site like e.g.  DOMAIN1\UserName & Password

  1. SharePoint Site: This site is hosted on different domain other than DOMAIN1 and has got windows/forms authentication. So the user to login to SharePoint site has to provide SharePoint site Credentials DOMAIN2\UserName & Password.
  2. SharePoint Web Part which shows external site in IFrame and allows user to perform CURD operation once the user is authenticated in external site.

What we want is once user login to SharePoint site using (Forms/Windows) authentication, he should be automatically authenticated in External Site (using some mechanism) the logged in user credentials are picked up from some store based on his sharepoint username and system authenticates the user on external site.

Any pointers to code/blogs/articles would be really helpful.

Akhilesh Nirapure

Variation 2010: Redirect the user

Hello guys, I am using SharePoint Variations 2010. Is there any way to hide the default language selector from the drop down menu, as I want to provide language links on the MasterPage instead! Do I need to alter this user control VariationsRootLanding.ascx!
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