| | |
redirecting back to referrer page in asp.net
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2009
Posts: 1
Reputation:
Solved Threads: 0
I have a link on page 1 if clicked take u to page 2
and page 2 if u click okay it should take u back to page
but when I use this on page 2 to:
it returns null,
how do I fix this
on page 1:
and page 2 if u click okay it should take u back to page
but when I use this on page 2 to:
ASP.NET Syntax (Toggle Plain Text)
ViewState["back"] = Request.UrlReferrer;
how do I fix this
on page 1:
ASP.NET Syntax (Toggle Plain Text)
link_Click(Obj sender, EventArgs e) { Response.Redirect("page2.aspx?ID" + row.cells[10].text) }
Last edited by peter_budo; Nov 2nd, 2009 at 7:07 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)
•
•
Join Date: Jun 2009
Posts: 452
Reputation:
Solved Threads: 82
0
#2 Nov 3rd, 2009
You need to to get the Request.UrlReferrer if(!IsPostBack) in the Page_Load event and store it in the viewstate if your page perform postbacks.
Sometimes the Request.UrlReferrer is null if you are using AJAX to call Response.Redirect.
The UrlReferrer is based on the value of HTTP_REFERER header that a browser should send. Sometimes internet anti virus programs such as Norton's Internet Security will strip the header. Therefore the Request.UrlReferrer will be empty.
Instead of believing the Request.UrlReferrer, send the current page name as query string to the other page. In the target page, store the value of the query string in ViewState.
Refer these links.
http://stackoverflow.com/questions/1...lreferrer-null
http://stackoverflow.com/questions/1...from-another-s
http://forums.asp.net/t/1101617.aspx
Sometimes the Request.UrlReferrer is null if you are using AJAX to call Response.Redirect.
The UrlReferrer is based on the value of HTTP_REFERER header that a browser should send. Sometimes internet anti virus programs such as Norton's Internet Security will strip the header. Therefore the Request.UrlReferrer will be empty.
Instead of believing the Request.UrlReferrer, send the current page name as query string to the other page. In the target page, store the value of the query string in ViewState.
Refer these links.
http://stackoverflow.com/questions/1...lreferrer-null
http://stackoverflow.com/questions/1...from-another-s
http://forums.asp.net/t/1101617.aspx
![]() |
Similar Threads
- Updated : Simple ASP.Net Login Page (ASP.NET)
- Login page in asp.net using oracle as back end (ASP.NET)
- How do i convert HTML page into ASP.net (ASP.NET)
- Login Page in asp.net using C# using MS access database (C#)
- how to avoid form load again after loading the page in asp.net (ASP.NET)
- Front-End Developer with ASP.net needed!!! (Web Development Job Offers)
- How to create a login page using ASp.net 2.0 c# (ASP.NET)
- How To Hyperlink Normal HTML page with ASP.NET Page? (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: Any Simple Code for binding data with gridview?
- Next Thread: radiobuttonlist postback error
Views: 975 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for asp.net, c#, redirect
.net 2.0 2d 301 access activedirectory app array asp asp.net bot c# casting chat check client combobox control courier database datagridview datetime dba dbconnection degrees deserialized development dialog directrobot disabled dll drawing dropdownmenu excel expression feedback file form forms gdi+ geometry google grid htaccess httpwebrequest iis image index javascript jsp lisp list listbox listview login malware marshalbyrefobject math messenger mssql mysql operator oracle packaging password photoshop picturebox post programming redirect remote remoting resource richtextbox saving select serialization sessions smoobjects sql sql-server statistics string textbox timer treeview uploadatextfile url user usercontrol validation vb.net vista visualstudio webbrowser windows7 winforms wizard wpf xml






