{"id":21,"date":"2010-05-05T16:08:15","date_gmt":"2010-05-05T10:38:15","guid":{"rendered":"http:\/\/JitendraZaa.com\/blog\/?p=21"},"modified":"2010-05-05T16:08:15","modified_gmt":"2010-05-05T10:38:15","slug":"asp-net-error-response-is-not-available-in-this-context","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/microsoft\/net\/asp-net-error-response-is-not-available-in-this-context\/","title":{"rendered":"ASP.Net Error: Response is not available in this context"},"content":{"rendered":"<p>This error occurred when\u00a0 i tried to call\u00a0<span style=\"color: #008080;\">Response.<span style=\"color: #0000ff;\">Redirect<\/span><\/span> method from a class file. Then i tried to find the solution and i got to know that when we use the response object from an aspx page either from aspx page or it&#8217;s codebehind page, the response object is directly available because all these derived from the page object.<\/p>\n<p>When we use the response object in our own class, the object is not directly available, so we got this message.<\/p>\n<p>But we can use it by the following method :<\/p>\n<p><span style=\"color: #008080;\">HttpContext.Current.Response.Redirect(<\/span>&#8220;<span style=\"color: #800000;\">http:\/\/google.com<\/span>&#8220;\u009d<span style=\"color: #008080;\">);<\/span><\/p>\n<p>Same problem happens when we tried to call a function from Response object.<\/p>\n<p>Thank You.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This error occurred when\u00a0 i tried to call\u00a0Response.Redirect method from a class file. Then i tried to find the solution and i got to know that when we use the response object from an aspx page either from aspx page or it&#8217;s codebehind page, the response object is directly available because all these derived from [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[21],"tags":[43],"class_list":["post-21","post","type-post","status-publish","format-standard","hentry","category-net","tag-asp-net"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":258,"url":"https:\/\/www.jitendrazaa.com\/blog\/microsoft\/net\/tracing-asp-net-website\/","url_meta":{"origin":21,"position":0},"title":"Tracing ASP.NET Website","author":"Jitendra","date":"June 28, 2010","format":false,"excerpt":"Demonstrates that how to Trace ASP.NET web applications","rel":"","context":"In &quot;ASP.NET&quot;","block_context":{"text":"ASP.NET","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/microsoft\/net\/"},"img":{"alt_text":"ASP.NET Tracing Output","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/05\/Tracing-FirstPage1.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":150,"url":"https:\/\/www.jitendrazaa.com\/blog\/microsoft\/net\/handlers-url-mapping-in-asp-net\/","url_meta":{"origin":21,"position":1},"title":"Handlers in ASP.NET","author":"Jitendra","date":"May 14, 2010","format":false,"excerpt":"HTTP Handlers is\u00a0a new technique presented in ASP.NET that was not present in the \"Classic ASP\".\u00a0HTTP Handlers are components that implement the System.Web.IHttpHandler interface. Unlike ASP.NET pages\u00a0Handlers dont have HTML-markup file, no events and other supporting. All they have is a code-file (written in any .NET-compatible language) that writes some\u2026","rel":"","context":"In &quot;ASP.NET&quot;","block_context":{"text":"ASP.NET","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/microsoft\/net\/"},"img":{"alt_text":"Step 1","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/05\/AddProject.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2395,"url":"https:\/\/www.jitendrazaa.com\/blog\/others\/tips\/asp-net-page-lifecycle\/","url_meta":{"origin":21,"position":2},"title":"ASP.NET Page Lifecycle","author":"Jitendra","date":"August 24, 2011","format":false,"excerpt":"Tutorial and sample source code on ASP.NET Page Lifecycle","rel":"","context":"In &quot;ASP.NET&quot;","block_context":{"text":"ASP.NET","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/microsoft\/net\/"},"img":{"alt_text":"Control hierarchy after page_init() event in asp.net page life cycle","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/08\/Control-hierarchy-after-page_init-event-in-asp.net-page-life-cycle.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":122,"url":"https:\/\/www.jitendrazaa.com\/blog\/others\/tips\/xml-parsing-error-no-element-found\/","url_meta":{"origin":21,"position":3},"title":"XML Parsing Error: no element found","author":"Jitendra","date":"May 13, 2010","format":false,"excerpt":"Few Days ago, i found strange error like \"XML Parsing Error: no element found\". I was unable to find the exact root cause. Most of the times it happens if you are missing any closing tag in your ASPZ application. I checked my complete page and reconfirmed but error still\u2026","rel":"","context":"In &quot;ASP.NET&quot;","block_context":{"text":"ASP.NET","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/microsoft\/net\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":125,"url":"https:\/\/www.jitendrazaa.com\/blog\/microsoft\/net\/cannot-access-a-closed-file-fileupload-in-asp-net\/","url_meta":{"origin":21,"position":4},"title":"cannot access a closed file &#8211; FileUpload in ASP.NET","author":"Jitendra","date":"May 13, 2010","format":false,"excerpt":"This was very\u00a0interesting\u00a0error, i got during development of file upload control in ASP.NET. On my local system, every thing was just fine. but when i deployed my application on development server, my control was able to upload only small size files. whenever i tried to upload large size file i\u2026","rel":"","context":"In &quot;ASP.NET&quot;","block_context":{"text":"ASP.NET","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/microsoft\/net\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1527,"url":"https:\/\/www.jitendrazaa.com\/blog\/microsoft\/net\/ajax-based-multiselect-jquery-autocomplete-control-in-asp-net\/","url_meta":{"origin":21,"position":5},"title":"Ajax Based Multiselect JQuery Autocomplete Control in ASP.Net","author":"Jitendra","date":"February 19, 2011","format":false,"excerpt":"Tutorial on creating Ajax Based Multiselect JQuery Autocomplete User Control in ASP.Net","rel":"","context":"In &quot;ASP.NET&quot;","block_context":{"text":"ASP.NET","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/microsoft\/net\/"},"img":{"alt_text":"Ajax Based Multiselect JQuery Autocomplete Control in ASP.Net","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/02\/Ajax-Based-Multiselect-JQuery-Autocomplete-Control-in-ASP.Net_.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/21","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=21"}],"version-history":[{"count":0,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/21\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=21"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=21"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=21"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}