1
// Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.MonoRail
.Framework
17 using System
.Collections
;
18 using System
.Collections
.Specialized
;
23 public interface IRedirectSupport
26 /// Redirects to url using referrer.
28 void RedirectToReferrer();
31 /// Redirects to the site root directory (<c>Context.ApplicationPath + "/"</c>).
33 void RedirectToSiteRoot();
36 /// Redirects to the specified url
38 /// <param name="url">An relative or absolute URL to redirect the client to</param>
39 void RedirectToUrl(string url
);
41 /// Redirects to the specified url
43 /// <param name="url">An relative or absolute URL to redirect the client to</param>
44 /// <param name="endProcess">if set to <c>true</c>, sends the redirect and
45 /// kills the current request process.</param>
46 void RedirectToUrl(string url
, bool endProcess
);
48 /// Redirects to the specified url
50 /// <param name="url">An relative or absolute URL to redirect the client to</param>
51 /// <param name="queryStringParameters">The querystring entries</param>
52 void RedirectToUrl(string url
, IDictionary queryStringParameters
);
54 /// Redirects to the specified url
56 /// <param name="url">An relative or absolute URL to redirect the client to</param>
57 /// <param name="queryStringParameters">The querystring entries</param>
58 void RedirectToUrl(string url
, NameValueCollection queryStringParameters
);
60 /// Redirects to the specified url
62 /// <param name="url">An relative or absolute URL to redirect the client to</param>
63 /// <param name="queryStringParameters">The querystring entries</param>
64 void RedirectToUrl(string url
, params string[] queryStringParameters
);
66 /// Redirects to the specified url
68 /// <param name="url">An relative or absolute URL to redirect the client to</param>
69 /// <param name="queryStringAnonymousDictionary">The querystring entries as an anonymous dictionary</param>
70 void RedirectToUrl(string url
, object queryStringAnonymousDictionary
);
74 /// Redirects to another controller's action.
76 /// <param name="controller">The controller name to be redirected to.</param>
77 /// <param name="action">The desired action on the target controller.</param>
78 void Redirect(string controller
, string action
);
80 /// Redirects to another controller's action with the specified parameters.
82 /// <param name="controller">The controller name to be redirected to.</param>
83 /// <param name="action">The desired action on the target controller.</param>
84 /// <param name="queryStringParameters">The querystring entries</param>
85 void Redirect(string controller
, string action
, NameValueCollection queryStringParameters
);
87 /// Redirects to another controller's action with the specified parameters.
89 /// <param name="controller">The controller name to be redirected to.</param>
90 /// <param name="action">The desired action on the target controller.</param>
91 /// <param name="queryStringParameters">The querystring entries</param>
92 void Redirect(string controller
, string action
, IDictionary queryStringParameters
);
94 /// Redirects to another controller's action with the specified parameters.
96 /// <param name="queryStringAnonymousDictionary">The querystring entries as an anonymous dictionary</param>
97 /// <param name="controller">The controller name to be redirected to.</param>
98 /// <param name="action">The desired action on the target controller.</param>
99 void Redirect(string controller
, string action
, object queryStringAnonymousDictionary
);
101 /// Redirects to another controller's action in a different area.
103 /// <param name="area">The area the target controller belongs to.</param>
104 /// <param name="controller">The controller name to be redirected to.</param>
105 /// <param name="action">The desired action on the target controller.</param>
106 void Redirect(string area
, string controller
, string action
);
108 /// Redirects to another controller's action in a different area with the specified parameters.
110 /// <param name="area">The area the target controller belongs to.</param>
111 /// <param name="controller">The controller name to be redirected to.</param>
112 /// <param name="action">The desired action on the target controller.</param>
113 /// <param name="queryStringParameters">The querystring entries</param>
114 void Redirect(string area
, string controller
, string action
, IDictionary queryStringParameters
);
116 /// Redirects to another controller's action in a different area with the specified parameters.
118 /// <param name="area">The area the target controller belongs to.</param>
119 /// <param name="controller">The controller name to be redirected to.</param>
120 /// <param name="action">The desired action on the target controller.</param>
121 /// <param name="queryStringParameters">The querystring entries</param>
122 void Redirect(string area
, string controller
, string action
, NameValueCollection queryStringParameters
);
124 /// Redirects to another controller's action in a different area with the specified parameters.
126 /// <param name="area">The area the target controller belongs to.</param>
127 /// <param name="controller">The controller name to be redirected to.</param>
128 /// <param name="action">The desired action on the target controller.</param>
129 /// <param name="queryStringAnonymousDictionary">The querystring entries as an anonymous dictionary</param>
130 void Redirect(string area
, string controller
, string action
, object queryStringAnonymousDictionary
);
134 /// Redirects using a named route.
135 /// The name must exists otherwise a <see cref="MonoRailException"/> will be thrown.
137 /// <param name="routeName">Route name.</param>
138 void RedirectUsingNamedRoute(string routeName
);
141 /// Redirects using a named route.
142 /// The name must exists otherwise a <see cref="MonoRailException"/> will be thrown.
144 /// <param name="routeName">Route name.</param>
145 /// <param name="routeParameters">The route parameters.</param>
146 void RedirectUsingNamedRoute(string routeName
, object routeParameters
);
149 /// Redirects using a named route.
150 /// The name must exists otherwise a <see cref="MonoRailException"/> will be thrown.
152 /// <param name="routeName">Route name.</param>
153 /// <param name="routeParameters">The route parameters.</param>
154 void RedirectUsingNamedRoute(string routeName
, IDictionary routeParameters
);
158 /// Tries to resolve the target redirect url by using the routing rules registered.
160 /// <param name="useCurrentRouteParams">if set to <c>true</c> the current request matching route rules will be used.</param>
161 /// <param name="controller">The controller name to be redirected to.</param>
162 /// <param name="action">The desired action on the target controller.</param>
163 void RedirectUsingRoute(string controller
, string action
, bool useCurrentRouteParams
);
165 /// Tries to resolve the target redirect url by using the routing rules registered.
167 /// <param name="useCurrentRouteParams">if set to <c>true</c> the current request matching route rules will be used.</param>
168 /// <param name="area">The area the target controller belongs to.</param>
169 /// <param name="controller">The controller name to be redirected to.</param>
170 /// <param name="action">The desired action on the target controller.</param>
171 void RedirectUsingRoute(string area
, string controller
, string action
, bool useCurrentRouteParams
);
173 /// Tries to resolve the target redirect url by using the routing rules registered.
175 /// <param name="action">The desired action on the target controller.</param>
176 /// <param name="controller">The controller name to be redirected to.</param>
177 /// <param name="routeParameters">The routing rule parameters.</param>
178 void RedirectUsingRoute(string controller
, string action
, IDictionary routeParameters
);
180 /// Tries to resolve the target redirect url by using the routing rules registered.
182 /// <param name="action">The desired action on the target controller.</param>
183 /// <param name="controller">The controller name to be redirected to.</param>
184 /// <param name="routeParameters">The routing rule parameters.</param>
185 void RedirectUsingRoute(string controller
, string action
, object routeParameters
);
187 /// Tries to resolve the target redirect url by using the routing rules registered.
189 /// <param name="area">The area the target controller belongs to.</param>
190 /// <param name="action">The desired action on the target controller.</param>
191 /// <param name="controller">The controller name to be redirected to.</param>
192 /// <param name="routeParameters">The routing rule parameters.</param>
193 void RedirectUsingRoute(string area
, string controller
, string action
, IDictionary routeParameters
);
195 /// Tries to resolve the target redirect url by using the routing rules registered.
197 /// <param name="area">The area the target controller belongs to.</param>
198 /// <param name="action">The desired action on the target controller.</param>
199 /// <param name="controller">The controller name to be redirected to.</param>
200 /// <param name="routeParameters">The routing rule parameters.</param>
201 void RedirectUsingRoute(string area
, string controller
, string action
, object routeParameters
);