https://github.com/ogaudefroy/tempdataforwebforms
TempData support for ASP.Net WebForms
https://github.com/ogaudefroy/tempdataforwebforms
asp-net tempdata webforms
Last synced: 6 months ago
JSON representation
TempData support for ASP.Net WebForms
- Host: GitHub
- URL: https://github.com/ogaudefroy/tempdataforwebforms
- Owner: ogaudefroy
- License: mit
- Created: 2016-10-11T18:59:49.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-11T08:08:41.000Z (over 8 years ago)
- Last Synced: 2025-05-28T02:42:55.561Z (8 months ago)
- Topics: asp-net, tempdata, webforms
- Language: C#
- Size: 25.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TempDataForWebForms
A simple library to provide ASP.Net MVC TempData like support in WebForms pages.
[](https://ci.appveyor.com/project/ogaudefroy/tempdataforwebforms) [](https://badge.fury.io/nu/TempDataForWebForms)
This component might help you when mixin ASP.Net WebForms navigation flow with ASP.Net MVC navigation flow in the same application.
Implementation is made with a custom HTTP Module implementing as following:
- On [PostMapRequestHandler](https://msdn.microsoft.com/en-us/library/system.web.httpapplication.postmaprequesthandler%28v=vs.110%29.aspx) fills the HttpContext.Items[HttpModule.KeyTempDataItems] with the tempdata loaded from the tempdata provider.
- On [EndRequest](https://msdn.microsoft.com/en-us/library/system.web.httpapplication.endrequest%28v=vs.110%29.aspx) clears tempdata if not in a redirection process.
ITempDataProvider implementation is resolved with ASP.Net MVC [DependencyResolver]() with the following behavior:
- If an [ITempDataProviderFactory](https://msdn.microsoft.com/en-us/library/system.web.mvc.itempdataproviderfactory(v=vs.118).aspx) implementation is registered then create a ITempDataProvider via [CreateInstance](https://msdn.microsoft.com/en-us/library/system.web.mvc.itempdataproviderfactory.createinstance(v=vs.118).aspx#M:System.Web.Mvc.ITempDataProviderFactory.CreateInstance).
- If an [ITempDataProvider](https://msdn.microsoft.com/en-us/library/system.web.mvc.itempdataprovider(v=vs.118).aspx) implementation is registered then return the registered implementation.
- Return a [SessionStateTempDataProvider](https://msdn.microsoft.com/en-us/library/system.web.mvc.sessionstatetempdataprovider(v=vs.118).aspx)
Typical use case: flash messages.