منتدى قسم تكنولوجيا المعلومات في مدرسة الدوحة الثانوية المستقلة للبنين
علمت أن رزقي لن يأخذه غيري فاطمأن قلبي

قم وذق طعم الصلاة في دجى الليل الطويل

قم وجاهد في الحياة ان مثوانا قليل
منتدى قسم تكنولوجيا المعلومات في مدرسة الدوحة الثانوية المستقلة للبنين
علمت أن رزقي لن يأخذه غيري فاطمأن قلبي

قم وذق طعم الصلاة في دجى الليل الطويل

قم وجاهد في الحياة ان مثوانا قليل
منتدى قسم تكنولوجيا المعلومات في مدرسة الدوحة الثانوية المستقلة للبنين
هل تريد التفاعل مع هذه المساهمة؟ كل ما عليك هو إنشاء حساب جديد ببضع خطوات أو تسجيل الدخول للمتابعة.

منتدى قسم تكنولوجيا المعلومات في مدرسة الدوحة الثانوية المستقلة للبنين

من أفضل مدارس قطر
 
الرئيسيةأحدث الصورالتسجيلدخول
قال الامام احمد بن حنبل: إن لنا إخوان لانراهم إلا مره كل سنه , نحن اوثق بمودتهم ممن نراهم كل يوم .أسعد الله قلوبا طاهره إن وصلناها شكرت وإن قصرنا عذرت
من العظماء من يشعر المرء فى حضرته أنه صغير ولكن العظيم بحق هو من يشعر الجميع في حضرته بأنهم عظماء
كم في المقابر من يحسدونك على هذه الأيام والليالي التي تعيشها يتمنون لو تسبيحة أو استغفار ينفعهم عند ربهم أو سجدة تنير قبورهم أو صدقة تظلهم بين يدي الملك الجبار .. فقط تذكر .. ولا تضيع الفرصة التي بين يديك

 

 Server.Transfer Vs. Response.Redirect

اذهب الى الأسفل 
2 مشترك
كاتب الموضوعرسالة
A.Tamimi
Admin
A.Tamimi


Posts : 1593
أهمية العضو : 16
Join date : 13/11/2008
Age : 38
Location : Jordan

Server.Transfer Vs. Response.Redirect Empty
مُساهمةموضوع: Server.Transfer Vs. Response.Redirect   Server.Transfer Vs. Response.Redirect Emptyالأربعاء ديسمبر 03, 2008 4:59 am

Server.Transfer Vs. Response.Redirect
By Karl Moore



If you read a lot of industry magazines and ASP.NET code samples, you may find that, although the majority use Response.Redirect to send the user to another page, some seem to prefer the rather mysterious-sounding Server.Transfer. So, what's the difference?

Well, Response.Redirect simply sends a message down to the browser, telling it to move to another page. So, you may run code like:
Response.Redirect("WebForm2.aspx")

or

Response.Redirect("http://www.karlmoore.com/")

to send the user to another page.

Server.Transfer is similar in that it sends the user to another page with a statement such as Server.Transfer("WebForm2.aspx"). However, the statement has a number of distinct advantages and disadvantages.

Firstly, transferring to another page using Server.Transfer
conserves server resources. Instead of telling the browser to redirect,
it simply changes the "focus" on the Web server and transfers the
request. This means you don't get quite as many HTTP requests coming
through, which therefore eases the pressure on your Web server and
makes your applications run faster.


But watch out: because the "transfer" process can work on only those sites running on the server, you can't use Server.Transfer to send the user to an external site. Only Response.Redirect can do that.

Secondly, Server.Transfer
maintains the original URL in the browser. This can really help
streamline data entry techniques, although it may make for confusion
when debugging.


That's not all: The Server.Transfer method also has a second parameter—"preserveForm". If you set this to True, using a statement such as Server.Transfer("WebForm2.aspx", True), the existing query string and any form variables will still be available to the page you are transferring to.

For example, if your WebForm1.aspx has a TextBox control called TextBox1 and you transferred to WebForm2.aspx with the preserveForm parameter set to True, you'd be able to retrieve the value of the original page TextBox control by referencing Request.Form("TextBox1").

This technique is
great for wizard-style input forms split over multiple pages. But
there's another thing you'll want to watch out for when using the preserveForm
parameter. ASP.NET has a bug whereby, in certain situations, an error
will occur when attempting to transfer the form and query string
values. You'll find this documented at http://support.microsoft.com/default.aspx?id=kb;en-us;Q316920.


The unofficial solution is to set the enableViewStateMac property to True on the page you'll be transferring to, then set it back to False. This records that you want a definitive False value for this property and resolves the bug.

So, in brief: Response.Redirect simply tells the browser to visit another page. Server.Transfer
helps reduce server requests, keeps the URL the same and, with a little
bug-bashing, allows you to transfer the query string and form variables.


<blockquote>Top Tip: Don't confuse Server.Transfer with Server.Execute,
which executes the page and returns the results. It was useful in the
past, but, with ASP.NET, it's been replaced with fresher methods of
development. Ignore it.

Server.Transfer Vs. Response.Redirect Jewels13



ليتك تحلو والحياة مريره وليتك ترضى والانام غضاب
وليت الذى بينى وبينك عامر وبينى وبين العالمين خراب
إذا صحّ منك الود فالكل هيّن وكل الذى فوق التراب تراب

اللهم ارحم موتانا وموتى جميع المسلمين
اللهم أنزل على قبورهم الضياء والنور والفسحة والسرور وجازهم بالاحسان إحسان وبالسيئات عفوا وغفرانا

</blockquote>
الرجوع الى أعلى الصفحة اذهب الى الأسفل
https://falcons.aforumfree.com
M.ALS3OD

M.ALS3OD


Posts : 854
أهمية العضو : 0
Join date : 13/09/2009
Age : 30
Location : AMMAN

Server.Transfer Vs. Response.Redirect Empty
مُساهمةموضوع: رد: Server.Transfer Vs. Response.Redirect   Server.Transfer Vs. Response.Redirect Emptyالسبت سبتمبر 19, 2009 2:36 am

مـــشـــكـــورررررررررررر
الرجوع الى أعلى الصفحة اذهب الى الأسفل
 
Server.Transfer Vs. Response.Redirect
الرجوع الى أعلى الصفحة 
صفحة 1 من اصل 1
 مواضيع مماثلة
-
» Incident Response Plan Example
» HTTP Response Headers
» Incident Response Plan
» Spy-Net Server Identifier v1.0
» Server Documentation Policy

صلاحيات هذا المنتدى:لاتستطيع الرد على المواضيع في هذا المنتدى
منتدى قسم تكنولوجيا المعلومات في مدرسة الدوحة الثانوية المستقلة للبنين :: ----§§§§ المنتديات التقنية والبرمجية §§§§---- :: قسم الدوت نت لتطوير الويب والديسكتوب-
انتقل الى: