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 the site root directory (<c>Context.ApplicationPath + "/"</c>).
28 void RedirectToSiteRoot();
31 /// Redirects to the specified url
33 /// <param name="url">An relative or absolute URL to redirect the client to</param>
34 void RedirectToUrl(string url
);
36 /// Redirects to the specified url
38 /// <param name="url">An relative or absolute URL to redirect the client to</param>
39 /// <param name="endProcess">if set to <c>true</c>, sends the redirect and
40 /// kills the current request process.</param>
41 void RedirectToUrl(string url
, bool endProcess
);
43 /// Redirects to the specified url
45 /// <param name="url">An relative or absolute URL to redirect the client to</param>
46 /// <param name="queryStringParameters">The querystring entries</param>
47 void RedirectToUrl(string url
, IDictionary queryStringParameters
);
49 /// Redirects to the specified url
51 /// <param name="url">An relative or absolute URL to redirect the client to</param>
52 /// <param name="queryStringParameters">The querystring entries</param>
53 void RedirectToUrl(string url
, NameValueCollection queryStringParameters
);
55 /// Redirects to the specified url
57 /// <param name="url">An relative or absolute URL to redirect the client to</param>
58 /// <param name="queryStringParameters">The querystring entries</param>
59 void RedirectToUrl(string url
, params string[] queryStringParameters
);
61 /// Redirects to the specified url
63 /// <param name="url">An relative or absolute URL to redirect the client to</param>
64 /// <param name="queryStringAnonymousDictionary">The querystring entries as an anonymous dictionary</param>
65 void RedirectToUrl(string url
, object queryStringAnonymousDictionary
);
69 /// Redirects to another controller's action.
71 /// <param name="controller">The controller name to be redirected to.</param>
72 /// <param name="action">The desired action on the target controller.</param>
73 void Redirect(string controller
, string action
);
75 /// Redirects to another controller's action with the specified parameters.
77 /// <param name="controller">The controller name to be redirected to.</param>
78 /// <param name="action">The desired action on the target controller.</param>
79 /// <param name="queryStringParameters">The querystring entries</param>
80 void Redirect(string controller
, string action
, NameValueCollection queryStringParameters
);
82 /// Redirects to another controller's action with the specified parameters.
84 /// <param name="controller">The controller name to be redirected to.</param>
85 /// <param name="action">The desired action on the target controller.</param>
86 /// <param name="queryStringParameters">The querystring entries</param>
87 void Redirect(string controller
, string action
, IDictionary queryStringParameters
);
89 /// Redirects to another controller's action with the specified parameters.
91 /// <param name="queryStringAnonymousDictionary">The querystring entries as an anonymous dictionary</param>
92 /// <param name="controller">The controller name to be redirected to.</param>
93 /// <param name="action">The desired action on the target controller.</param>
94 void Redirect(string controller
, string action
, object queryStringAnonymousDictionary
);
96 /// Redirects to another controller's action in a different area.
98 /// <param name="area">The area the target controller belongs to.</param>
99 /// <param name="controller">The controller name to be redirected to.</param>
100 /// <param name="action">The desired action on the target controller.</param>
101 void Redirect(string area
, string controller
, string action
);
103 /// Redirects to another controller's action in a different area with the specified parameters.
105 /// <param name="area">The area the target controller belongs to.</param>
106 /// <param name="controller">The controller name to be redirected to.</param>
107 /// <param name="action">The desired action on the target controller.</param>
108 /// <param name="queryStringParameters">The querystring entries</param>
109 void Redirect(string area
, string controller
, string action
, IDictionary queryStringParameters
);
111 /// Redirects to another controller's action in a different area with the specified parameters.
113 /// <param name="area">The area the target controller belongs to.</param>
114 /// <param name="controller">The controller name to be redirected to.</param>
115 /// <param name="action">The desired action on the target controller.</param>
116 /// <param name="queryStringParameters">The querystring entries</param>
117 void Redirect(string area
, string controller
, string action
, NameValueCollection queryStringParameters
);
119 /// Redirects to another controller's action in a different area with the specified parameters.
121 /// <param name="area">The area the target controller belongs to.</param>
122 /// <param name="controller">The controller name to be redirected to.</param>
123 /// <param name="action">The desired action on the target controller.</param>
124 /// <param name="queryStringAnonymousDictionary">The querystring entries as an anonymous dictionary</param>
125 void Redirect(string area
, string controller
, string action
, object queryStringAnonymousDictionary
);
129 /// Tries to resolve the target redirect url by using the routing rules registered.
131 /// <param name="useCurrentRouteParams">if set to <c>true</c> the current request matching route rules will be used.</param>
132 /// <param name="controller">The controller name to be redirected to.</param>
133 /// <param name="action">The desired action on the target controller.</param>
134 void RedirectUsingRoute(string controller
, string action
, bool useCurrentRouteParams
);
136 /// Tries to resolve the target redirect url by using the routing rules registered.
138 /// <param name="useCurrentRouteParams">if set to <c>true</c> the current request matching route rules will be used.</param>
139 /// <param name="area">The area the target controller belongs to.</param>
140 /// <param name="controller">The controller name to be redirected to.</param>
141 /// <param name="action">The desired action on the target controller.</param>
142 void RedirectUsingRoute(string area
, string controller
, string action
, bool useCurrentRouteParams
);
144 /// Tries to resolve the target redirect url by using the routing rules registered.
146 /// <param name="action">The desired action on the target controller.</param>
147 /// <param name="controller">The controller name to be redirected to.</param>
148 /// <param name="routeParameters">The routing rule parameters.</param>
149 void RedirectUsingRoute(string controller
, string action
, IDictionary routeParameters
);
151 /// Tries to resolve the target redirect url by using the routing rules registered.
153 /// <param name="action">The desired action on the target controller.</param>
154 /// <param name="controller">The controller name to be redirected to.</param>
155 /// <param name="routeParameters">The routing rule parameters.</param>
156 void RedirectUsingRoute(string controller
, string action
, object routeParameters
);
158 /// Tries to resolve the target redirect url by using the routing rules registered.
160 /// <param name="area">The area the target controller belongs to.</param>
161 /// <param name="action">The desired action on the target controller.</param>
162 /// <param name="controller">The controller name to be redirected to.</param>
163 /// <param name="routeParameters">The routing rule parameters.</param>
164 void RedirectUsingRoute(string area
, string controller
, string action
, IDictionary routeParameters
);
166 /// Tries to resolve the target redirect url by using the routing rules registered.
168 /// <param name="area">The area the target controller belongs to.</param>
169 /// <param name="action">The desired action on the target controller.</param>
170 /// <param name="controller">The controller name to be redirected to.</param>
171 /// <param name="routeParameters">The routing rule parameters.</param>
172 void RedirectUsingRoute(string area
, string controller
, string action
, object routeParameters
);