.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

Redirecting with ASP

Posted By:      Posted Date: September 06, 2010    Points: 0   Category :ASP.Net
I am using VB.NET in Visual Studio 2005 and was wondering.. can I do a "Response.Redirect" or something similar? But not from asp page (e.g. Default.aspx), but from a seperate class.. MyClass.vb?is there anything similar I can do?Thanks

View Complete Post

More Related Resource Links

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!!!





Logout not redirecting correctly


I have the following control on my master page


asp:LoginStatus ID="LoginStatus1" runat

C# .NET SqlBulkCopy and redirecting error rows

I am using SqlBulkCopy within a Script Task to extract data from an Oracle server into SQL Server. Is there a way to redirect error rows with code or otherwise from the SqlBulkCopy? I have implemented this before using a regular Copy Column task and redirecting the Destination Error into a different table of all data type varchar. So I am trying to make something similar with the script task and SqlBulkCopy. Any suggestions? ThanksYou are so wise...like a miniature budha covered in fur. -Anchorman

How do we redirecting rows using stored procedure

Hi I have one SQL Execute task and it runs one stored procedure inside it. That SP inserts data into one of table.Now when I inserts records into this tbale let's say because of primary key some records are failing so how can i redirect this rows in stored procedure  

I want 404 instead of redirecting to login page

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"

Redirecting a view doesn't work

I have the following class that I have all my controllers inherit from:  using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Security.Principal; using System.Web; using System.Web.Mvc; using System.Web.Routing; using System.Web.Security; using LMWebUI.Models; using LMWebUI.Components; namespace LMWebUI.Controllers { public class BaseController : Controller { private UserSettings _currentUser = null; private HttpContextBase _currentContext = null; public UserSettings CurrentUser { get { if (_currentUser == null) _currentUser = UserHelper.GetUser(_currentContext); return _currentUser; } } public string CurrentController { get { return Utility.LastSplit(ToString(), '.'); } } public void SaveUser() { UserHelper.SaveSettings(this.HttpContext, CurrentUser); } protected override void Execute(RequestContext requestContext) { _currentContext = requestContext.HttpContext; if (Utility.FixNull(requestContext.HttpContext.Request.QueryString["noScript"], "") == "true") { CurrentUser.ScriptingMode = UserSettings.ScriptMode.NoScript; } else { if (CurrentUser.ScriptingMode == UserSettings.ScriptMode.ScriptDetection && Utility.ReadCookie(requestContext.HttpContext.Request.Cookies, "HasScri

Redirecting default.aspx to root virtual directory

I have a simple ASP.NET 3.5 application running under IIS7 under a virtual directory. So the URL of my app is like http://site.com/app. I want to 301-redirect the request to site.com/app/default.aspx to site.com/app for better SEO. I have to do this redirect through code only, not by any IIS settings. I am unable to do so via code mentioned in this article:http://www.4guysfromrolla.com/articles/072810-1.aspxThe code:if (request.RawUrl.Equals("/default.aspx")) { newUrl = string.Format("{0}://{1}{2}", request.Url.Scheme, request.Url.Authority, request.RawUrl.Remove(request.RawUrl.LastIndexOf("/default.aspx", StringComparison.OrdinalIgnoreCase))); context.Response.Status = "301 moved permanently"; context.Response.AddHeader("Location", newUrl); } seems to go into an infinite loop when the application is under a virtual directory. the request.RawUrl property always returns "/default.aspx" even after a 301 redirect causing the infinite loop. How can I fix this issuhttp://forums.asp.net/AddPost.aspx?ForumID=27e?

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.

Error Firefox has detected that the server is redirecting the request for this address in a way tha

The page isn't redirecting properly                                                        Firefox has detected that the server is redirecting the request for this address in a way that will never complete.                            *   This problem can sometimes be caused by disabling or refusing to accept          cookies.

Redirecting user on login

 I have 3 roles set up and want to redirect user after login depending on userrole. my code is: Protected Sub Login1_LoggedIn(ByVal sender As Object, ByVal e As System.EventArgs) Handles Login1.LoggedIn 'if there is no returnUrl in the query string , we redirect based on user role If String.IsNullOrEmpty(Request.QueryString("ReturnUrl")) Then If Roles.IsUserInRole(Login1.UserName, "Administrator") Then Response.Redirect("~/Administration/") End If If Roles.IsUserInRole(Login1.UserName, "Member") Then Response.Redirect("~/Members/") End If If Roles.IsUserInRole(Login1.UserName, "PaidMember") Then Response.Redirect("~/Members/") End If End If End Sub   It seems to hit the first if statement and redirects the admin to the right folder but the members do not get redirected. I am not sure what I am missing.. this seems to be a pretty simple thing to do but will not work right for some reason.

Problem redirecting

hi guysi had a lot of help from a friend in here but i am now stuck and i cant figure it out.  I am trying to get the clicked value and redirect it to another page and i get this error System.NullReferenceException: Object reference not set to an instance of an object.Please see my code belowImports System.DataPartial Class search    Inherits System.Web.UI.Page    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)        If Not IsPostBack Then            Dim dt As New DataTable()            Dim dr As DataRow            dt.Columns.Add("PatientID", GetType(String))            dt.Columns.Add("VisitDate", GetType(String))            dr = dt.NewRow()            dr("PatientID") = "1"            dr("VisitDate") = "12/08/2010"            dt.Rows.Add(dr)         &

syntax for redirecting multiple values

hi guysi have this code for redirecting one valueResponse.Redirect("contact.aspx?Pat=" + row.Cells(0).Text.Trim()i try doing this Response.Redirect("contact.aspx?Pat=" + row.Cells(0).Text.Trim() & "contact.aspx?Nam=" + row.Cells(1).Text.Trim())but on my landing page it concatenates the 2this is my landing pageProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load        PatID.Text = Convert.ToString(Request.QueryString("Pat"))        Patname.Text = Convert.ToString(Request.QueryString("Nam"))so basically it puts everything in my PatID parameterany idead how to pass 2 values????

Redirecting to the right site collection

Under Central Administration, I created a web application called SP.  I have two site collections in there that I created, http://sp , and http://sp/nextfolder/home .  The sp site collection is irrelevant right now. It's going to be my corporate intranet eventually.  The other thing is already completed, and needs to go outside. I extended my SP web application to https, and it is tied to the web address I purchased.  The problem is, when I go to https://myaddress.com , I get taken to the outside equivalent of http://sp .  I would have to type in myaddress.com/otherfolder/home to get to the correct site.  What I tried to do, was, in IIS, I went to the HTTP redirect settings, checked the redirect requests to this destination, and tried the following: https://myaddress.com/otherfolder/home and  /otherfolder/home/default.aspx, .  When I have these options set, the redirecting works, kinda. It redirects to https://myaddress.com/otherfolder/home/otherfolder/home/otherfolder/home/otherfolder/home   or  https://myaddress.com/otherfolder/home/default.aspx/otherfolder/home/default.aspx/otherfolder/home/default.aspx    and so forth. Obviously this is not the desired outcome.  Any suggestions?

Redirecting to another page from an eventhandler on ItemAdding event

Hi,   I want to redirect to another page from an eventhandler on ItemAdding event. So please help me achieve in achieving this.    Thanks in Advance

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

redirecting from EditForm.aspx. to NewForm.aspx directly


Hi All,

My Requirement is...

I have two lists. List "Project Request" and "Project List". When I am upading a item from "Project Request" list in EditForm.aspx. After clicking on the ok the aplication should redirect me to NewForm.aspx of ProjectList.

I have checked in so many blogs it can be achieved through EventReciver only. But not able to ressolve how to achive.

Please help me with code snippet.

Thanks in Advance.....


Redirecting Anonymous users IIS 7



I am working on an internal application... i setup IIS 7 to use windows authentication since its behind the firewall and on the domain.. there is a "public" side.. and an "internal" side... if your not part of IT.. you should get the public side.. this is just informational.. my problem is that there is 1 or two pcs that are not on the domain and nobody is logged into them.. how can i just redirect anonymous users to another site???????


everything i read says you can't use anonymous AND windows auth.. so my thought was to just redirect the anonymous users to another site.. how can you do that??  



any help is appreciated!






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