当前位置: 首页>>代码示例>>C#>>正文


C# UrlHelper.AbsoluteAction方法代码示例

本文整理汇总了C#中System.Web.Mvc.UrlHelper.AbsoluteAction方法的典型用法代码示例。如果您正苦于以下问题:C# UrlHelper.AbsoluteAction方法的具体用法?C# UrlHelper.AbsoluteAction怎么用?C# UrlHelper.AbsoluteAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.Mvc.UrlHelper的用法示例。


在下文中一共展示了UrlHelper.AbsoluteAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnActionExecuting

 public override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     var helper = new UrlHelper(filterContext.RequestContext);
     var redirectUrl=helper.AbsoluteAction("Logon", "Account");
     var wargamingApi = IoC.Resolve<IWargamingApi>();
     filterContext.Controller.ViewBag.OAuthUrl=wargamingApi.GetLoginUrl(redirectUrl);
 }
开发者ID:Eskat0n,项目名称:Wotstat,代码行数:7,代码来源:OAuthUrlAttribute.cs

示例2: TrackbackRdf

        public static MvcHtmlString TrackbackRdf(this HtmlHelper html, PostViewModel post)
        {
            if (post.AreCommentsClosed || post.Post.IsCommentAllowed == false)
            {
                return MvcHtmlString.Create(string.Empty);
            }

            var urlHelper = new UrlHelper(html.ViewContext.RequestContext);
            var postUrl = urlHelper.AbsoluteAction("Details", "PostDetails", post.Post.ToRouteData());
            var trackbackUrl = urlHelper.AbsoluteAction("Trackback", "Services", new
            {
                id = post.Post.Id
            });

            return MvcHtmlString.Create(GetTrackbackRdf(postUrl, post.Post.Title, trackbackUrl));
        }
开发者ID:Gutek,项目名称:MovingScrewdriver,代码行数:16,代码来源:HtmlHelperExtensions.cs

示例3: CreateProtectedUrl

        private string CreateProtectedUrl(string action, CommentPart part) {
            var workContext = _workContextAccessor.GetContext();
            if (workContext.HttpContext != null) {
                var url = new UrlHelper(workContext.HttpContext.Request.RequestContext);
                return url.AbsoluteAction(action, "Comment", new {area = "Orchard.Comments", nonce = _commentService.CreateNonce(part, TimeSpan.FromDays(7))});
            }

            return null;
        }
开发者ID:kanujhun,项目名称:orchard,代码行数:9,代码来源:CommentTokens.cs

示例4: ExecuteResult

        public override void ExecuteResult(ControllerContext context)
        {
            var url = new UrlHelper(HttpContext.Current.Request.RequestContext);
            var factory = new Elmah.ErrorLogPageFactory();
            if (!string.IsNullOrEmpty(_resouceType))
            {
                var pathInfo = "." + _resouceType;
                HttpContext.Current.RewritePath(url.AbsoluteAction("Index", "Elmah"), pathInfo, HttpContext.Current.Request.QueryString.ToString());
            }

            var handler = factory.GetHandler(HttpContext.Current, null, null, null);

            handler.ProcessRequest(HttpContext.Current);
        }
开发者ID:merwan,项目名称:RaccoonBlog,代码行数:14,代码来源:ElmahResult.cs

示例5: GetPreviewUrl

        public MvcHtmlString GetPreviewUrl(UrlHelper helper)
        {
            var root = HttpContext.Current.Request.ApplicationPath ?? "/";
            if (!root.EndsWith("/"))
            {
                root += "/";
            }

            var path = string.Format("{0}{1}/{2}", root, SelectedMeme, string.Join("/", Lines));
            var strippedPath = _previewUrlStripper.Replace(path, "-");
            var trimmedPath = strippedPath.TrimEnd('/');
            var pathWithExtension = trimmedPath + ".jpg";

            return MvcHtmlString.Create(helper.AbsoluteAction(pathWithExtension));
        }
开发者ID:nsauber,项目名称:upboat.me,代码行数:15,代码来源:BuilderViewModel.cs

示例6: PasswordRecovery

		public ActionResult PasswordRecovery(PasswordRecoveryViewModel model)
		{
			if (ModelState.IsValid)
			{
				var sessionId = _resetPasswordService.SetResetPasswordSession(model);
				CommitProviderInstance.Commit();
				
				var urlHelper = new UrlHelper(this.Request.RequestContext);

				model.ChangePasswordUrl = urlHelper.AbsoluteAction(NameHelper.ResetPassword.ChangePassword, NameHelper.ResetPassword.Controller, new { area = "", sessionId = sessionId });

				_taskManager.ScheduleResetPasswordNotification(model.Email, model.ChangePasswordUrl);				
				ViewBag.ShowCofirmation = true;
			}

			return View(model);
		}
开发者ID:evkap,项目名称:DVS,代码行数:17,代码来源:ResetPasswordController.cs

示例7: Rsd

        public ActionResult Rsd(string path) {
            Logger.Debug("RSD requested");

            var blogPath = _rsdConstraint.FindPath(path);
            
            if (blogPath == null)
                return HttpNotFound();

            BlogPart blogPart = _blogService.Get(blogPath);

            if (blogPart == null)
                return HttpNotFound();

            const string manifestUri = "http://archipelago.phrasewise.com/rsd";

            var urlHelper = new UrlHelper(ControllerContext.RequestContext, _routeCollection);
            var url = urlHelper.AbsoluteAction("", "", new { Area = "XmlRpc" });

            var options = new XElement(
                XName.Get("service", manifestUri),
                new XElement(XName.Get("engineName", manifestUri), "Orchard CMS"),
                new XElement(XName.Get("engineLink", manifestUri), "http://orchardproject.net"),
                new XElement(XName.Get("homePageLink", manifestUri), "http://orchardproject.net"),
                new XElement(XName.Get("apis", manifestUri),
                    new XElement(XName.Get("api", manifestUri),
                        new XAttribute("name", "MetaWeblog"),
                        new XAttribute("preferred", true),
                        new XAttribute("apiLink", url),
                        new XAttribute("blogID", blogPart.Id))));

            var doc = new XDocument(new XElement(
                                        XName.Get("rsd", manifestUri),
                                        new XAttribute("version", "1.0"),
                                        options));

            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            return Content(doc.ToString(), "text/xml");
        }
开发者ID:RasterImage,项目名称:Orchard,代码行数:38,代码来源:RemoteBlogPublishingController.cs

示例8: MetaWeblogGetUserBlogs

        private XRpcArray MetaWeblogGetUserBlogs(UrlHelper urlHelper,
            string appkey,
            string userName,
            string password) {

            var user = _membershipService.ValidateUser(userName, password);
            _authorizationService.CheckAccess(StandardPermissions.AccessFrontEnd, user, null);

            var array = new XRpcArray();
            foreach (var blog in _blogService.Get()) {
                array.Add(new XRpcStruct()
                              .Set("url", urlHelper.AbsoluteAction(() => urlHelper.Blog(blog.Slug)))
                              .Set("blogid", blog.Id)
                              .Set("blogName", blog.Name));
            }
            return array;
        }
开发者ID:mofashi2011,项目名称:orchardcms,代码行数:17,代码来源:XmlRpcHandler.cs

示例9: MetaWeblogGetUserBlogs

        private XRpcArray MetaWeblogGetUserBlogs(UrlHelper urlHelper,
            string userName,
            string password)
        {
            IUser user = ValidateUser(userName, password);

            XRpcArray array = new XRpcArray();
            foreach (BlogPart blog in _blogService.Get()) {
                // User needs to at least have permission to edit its own blog posts to access the service
                if (_authorizationService.TryCheckAccess(Permissions.EditBlogPost, user, blog)) {

                    BlogPart blogPart = blog;
                    array.Add(new XRpcStruct()
                                  .Set("url", urlHelper.AbsoluteAction(() => urlHelper.Blog(blogPart)))
                                  .Set("blogid", blog.Id)
                                  .Set("blogName", blog.Name));
                }
            }

            return array;
        }
开发者ID:stack72,项目名称:GiveCamp-London,代码行数:21,代码来源:XmlRpcHandler.cs

示例10: GetDetailFullUrl

        public static string GetDetailFullUrl(this Rental rental, UrlHelper urlHelper)
        {
            if (rental == null || urlHelper == null)
                return null;

            return urlHelper.AbsoluteAction(MVC.Rental.ActionNames.Detail, MVC.Rental.Name, new { id = rental.Id });
        }
开发者ID:tah91,项目名称:eworkyWebSite,代码行数:7,代码来源:ModelHelper.cs

示例11: RequestEmailChange

 private void RequestEmailChange(UserModel viewModel, UrlHelper helper, User user)
 {
     string originalPendingEmail = user.PendingEmail;
     if (viewModel.PendingEmail != user.EmailAddress)
     {
         viewModel.CopyTo(user);
         string actionEndpoint = helper.AbsoluteAction("ConfirmEmail", "Account");
         Uri confirmationEndpoint = new Uri(actionEndpoint);
         EmailConfirmationManager.Request(user, confirmationEndpoint);
     }
     else
     {
         viewModel.CopyTo(user);
     }
 }
开发者ID:modulexcite,项目名称:StudentSuccessDashboard,代码行数:15,代码来源:AccountManager.cs

示例12: CreateBlogStruct

        private static XRpcStruct CreateBlogStruct(
            BlogPostPart blogPostPart,
            UrlHelper urlHelper)
        {
            var url = urlHelper.AbsoluteAction(() => urlHelper.BlogPost(blogPostPart));
            var blogStruct = new XRpcStruct()
                .Set("postid", blogPostPart.Id)
                .Set("title", blogPostPart.Title)
                .Set("wp_slug", blogPostPart.Slug)
                .Set("description", blogPostPart.Text)
                .Set("link", url)
                .Set("permaLink", url);

            if (blogPostPart.PublishedUtc != null) {
                blogStruct.Set("dateCreated", blogPostPart.PublishedUtc);
                blogStruct.Set("date_created_gmt", blogPostPart.PublishedUtc);
            }

            return blogStruct;
        }
开发者ID:stack72,项目名称:GiveCamp-London,代码行数:20,代码来源:XmlRpcHandler.cs

示例13: ContactUs

		public ActionResult ContactUs(ContactUsViewModel model)
		{
			if (User.Identity.IsAuthenticated)
				ModelState.Remove("CaptchaAnswer");
			if (!ModelState.IsValid)
			{
				return View(model);
			}
			var urlHelper = new UrlHelper(this.Request.RequestContext);

			if (User.Identity.IsAuthenticated)
			{
				if (SecurityContext.CurrentUser.HasUserAnyRoles(RoleType.DvsAdmin, RoleType.DvsSuperAdmin))
				{
					model.UserDetailsUrl = urlHelper.AbsoluteAction("UserDetails", "DVSViewEdit", new { area = "UserManagement", Id = SecurityContext.CurrentUser.Id });
				}
				else if (SecurityContext.CurrentUser.HasUserAnyRoles(RoleType.Appraiser, RoleType.AppraisalCompanyAdmin, RoleType.CompanyAdminAndAppraiser))
				{
					model.UserDetailsUrl = urlHelper.AbsoluteAction("Index", "AppraiserProfile", new { area = "Appraiser", userId = SecurityContext.CurrentUser.Id });
				}
				_taskManager.ScheduleContactUsFromLoggedUserNotification(
					SecurityContext.CurrentUser.Email,
					model.Email,
					model.Message,
					model.PhoneNumber,
					model.Name,
					model.UserDetailsUrl
					);
			}
			else
			{
				_taskManager.ScheduleContactUsFromAnonymNotification(
					model.Email,
					model.Message,
					model.PhoneNumber,
					model.Name,
					model.CompanyName);
			}
			ViewBag.ConfirmMessage = string.Format(Constants.ConfirmMessages.ContactUsSuccessMessage, model.Name);

			return View(model);
		}
开发者ID:evkap,项目名称:DVS,代码行数:42,代码来源:HomeController.cs

示例14: Execute

        public void Execute(Orchard.Core.Feeds.Models.FeedContext context)
        {
            var idValue = context.ValueProvider.GetValue("id");
            var connectorValue = context.ValueProvider.GetValue("connector");

            var limitValue = context.ValueProvider.GetValue("limit");
            var limit = 20;
            if (limitValue != null)
            {
                limit = (int)limitValue.ConvertTo(typeof(int));
            }

            var id = (int)idValue.ConvertTo(typeof(int));
            var connectorName = (string)connectorValue.ConvertTo(typeof(string));
            
            var item = Services.ContentManager.Get(id);

            var socket = item.As<SocketsPart>();

            var connectors = socket.Sockets[connectorName].Connectors.List(
                q => q.ForPart<CommonPart>().OrderBy<CommonPartRecord>(c => c.CreatedUtc),
                q=>q.ForPart<ConnectorPart>().Slice(0,limit));
            var site = Services.WorkContext.CurrentSite;
            var url = new UrlHelper(_requestContext);
            if (context.Format == "rss")
            {
                var link = new XElement("link");
                context.Response.Element.SetElementValue("title", GetTitle(item.GetTitle(), site));
                context.Response.Element.Add(link);
                context.Response.Element.SetElementValue("description", item.GetBody());
                context.Response.Contextualize(requestContext => link.Add(url.AbsoluteAction(()=>url.ItemDisplayUrl(item))));
            }
            else
            {
                context.Builder.AddProperty(context, null, "title", GetTitle(item.GetTitle(), site));
                context.Builder.AddProperty(context, null, "description", item.GetBody());
                context.Response.Contextualize(requestContext => context.Builder.AddProperty(context, null, "link", url.AbsoluteAction(() => url.ItemDisplayUrl(item))));
            }

            foreach (var child in connectors)
            {
                context.Builder.AddItem(context, child.RightContent.ContentItem);
            }

        }
开发者ID:akhurst,项目名称:ricealumni,代码行数:45,代码来源:MechanicsFeedQueryProvider.cs

示例15: CreateBlogStruct

        private static XRpcStruct CreateBlogStruct(
            BlogPostPart blogPostPart,
            UrlHelper urlHelper)
        {
            var url = urlHelper.AbsoluteAction(() => urlHelper.ItemDisplayUrl(blogPostPart));

            if (blogPostPart.HasDraft()) {
                url = urlHelper.AbsoluteAction("Preview", "Item", new { area = "Contents", id = blogPostPart.ContentItem.Id });
            }

            var blogStruct = new XRpcStruct()
                .Set("postid", blogPostPart.Id)
                .Set("title", HttpUtility.HtmlEncode(blogPostPart.Title))

                .Set("description", blogPostPart.Text)
                .Set("link", url)
                .Set("permaLink", url);

            blogStruct.Set("wp_slug", blogPostPart.As<IAliasAspect>().Path);

            if (blogPostPart.PublishedUtc != null) {
                blogStruct.Set("dateCreated", blogPostPart.PublishedUtc);
                blogStruct.Set("date_created_gmt", blogPostPart.PublishedUtc);
            }

            return blogStruct;
        }
开发者ID:CAAFA,项目名称:caafa_internet,代码行数:27,代码来源:XmlRpcHandler.cs


注:本文中的System.Web.Mvc.UrlHelper.AbsoluteAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。