internal void GetCookielessSessionID(HttpContext context, bool allowRedirect, out bool cookieless) { HttpRequest request; string id; Debug.Trace("SessionIDManager", "Beginning SessionIDManager::GetCookielessSessionID"); request = context.Request; // Please note that even if the page doesn't require session state, we still need // to read the session id because we have to update the state's timeout value cookieless = CookielessHelperClass.UseCookieless(context, allowRedirect, Config.Cookieless); context.Items[COOKIELESS_BOOL_SESSION_KEY] = cookieless; Debug.Trace("SessionIDManager", "cookieless=" + cookieless); if (cookieless) { /* * Check if it's cookie-less session id */ id = context.CookielessHelper.GetCookieValue('S'); if (id == null) { id = String.Empty; } // Decode() is caled on all id's before saved to URL or cookie id = Decode(id); if (!ValidateInternal(id, false)) { Debug.Trace("SessionIDManager", "No legitimate cookie on path\nReturning from SessionStateModule::GetCookielessSessionID"); return; } context.Items.Add(COOKIELESS_SESSION_KEY, id); Debug.Trace("SessionIDManager", "CookielessSessionModule found SessionId=" + id + "\nReturning from SessionIDManager::GetCookielessSessionID"); } }
internal void GetCookielessSessionID(HttpContext context, bool allowRedirect, out bool cookieless) { HttpRequest request = context.Request; cookieless = CookielessHelperClass.UseCookieless(context, allowRedirect, Config.Cookieless); context.Items["AspCookielessBoolSession"] = (bool)cookieless; if (cookieless) { string cookieValue = context.CookielessHelper.GetCookieValue('S'); if (cookieValue == null) { cookieValue = string.Empty; } cookieValue = this.Decode(cookieValue); if (this.ValidateInternal(cookieValue, false)) { context.Items.Add("AspCookielessSession", cookieValue); } } }
private string GetActionAttribute() { string virtualPathString; string action = this.Action; if (!string.IsNullOrEmpty(action)) { return(action); } VirtualPath clientFilePath = this.Context.Request.ClientFilePath; if (this.Context.ServerExecuteDepth == 0) { virtualPathString = clientFilePath.VirtualPathString; int num = virtualPathString.LastIndexOf('/'); if (num >= 0) { virtualPathString = virtualPathString.Substring(num + 1); } } else { VirtualPath currentExecutionFilePathObject = this.Context.Request.CurrentExecutionFilePathObject; virtualPathString = clientFilePath.MakeRelative(currentExecutionFilePathObject).VirtualPathString; } if ((CookielessHelperClass.UseCookieless(this.Context, false, FormsAuthentication.CookieMode) && (this.Context.Request != null)) && (this.Context.Response != null)) { virtualPathString = this.Context.Response.ApplyAppPathModifier(virtualPathString); } string clientQueryString = this.Page.ClientQueryString; if (!string.IsNullOrEmpty(clientQueryString)) { virtualPathString = virtualPathString + "?" + clientQueryString; } return(virtualPathString); }
private string GetActionAttribute() { // If the Action property is nonempty, we use it instead of the current page. This allows the developer // to support scenarios like PathInfo, UrlMapping, etc. (DevDiv Bugs 164390) string actionProperty = Action; if (!String.IsNullOrEmpty(actionProperty)) { return(actionProperty); } string action; VirtualPath clientFilePath = Context.Request.ClientFilePath; // ASURT 15075/11054/59970: always set the action to the current page. // DevDiv Servicing 215795/Dev10 567580: The IIS URL Rewrite module and other rewrite // scenarios need the postback action to be the original URL. Note however, if Server.Transfer/Execute // is used, the action will be set to the transferred/executed page, that is, the value of // CurrentExecutionFilePathObject. This is because of ASURT 59970 and the document attached to // that if (Context.ServerExecuteDepth == 0) { // There hasn't been any Server.Transfer or RewritePath. // ASURT 15979: need to use a relative path, not absolute action = clientFilePath.VirtualPathString; int iPos = action.LastIndexOf('/'); if (iPos >= 0) { // Ensure the segment is always a relative path, so prepend a dot-segment // (RFC section 4.2 Relative Reference) action = "./" + action.Substring(iPos + 1); } } else { VirtualPath currentFilePath = Context.Request.CurrentExecutionFilePathObject; // Server.Transfer or RewritePath case. We need to make the form action relative // to the original ClientFilePath (since that's where the browser thinks we are). currentFilePath = clientFilePath.MakeRelative(currentFilePath); action = currentFilePath.VirtualPathString; } // VSWhidbey 202380: If cookieless is on, we need to add the app path modifier to the form action bool cookieless = CookielessHelperClass.UseCookieless(Context, false, FormsAuthentication.CookieMode); if (cookieless && Context.Request != null && Context.Response != null) { action = Context.Response.ApplyAppPathModifier(action); } // Dev11 406986: <form> elements must have non-empty 'action' attributes to pass W3 validation. // The only time this might happen is that the current file path is "", which meant that the // incoming URL ended in a slash, so we can just point 'action' back to the current directory. if (String.IsNullOrEmpty(action) && RenderingCompatibility >= VersionUtil.Framework45) { action = "./"; } // Dev11 177096: The action may be empty if the RawUrl does not point to a file (for e.g. http://localhost:8080/) but is never null. // Empty action values work fine since the form does not emit the action attribute. Debug.Assert(action != null); string queryString = Page.ClientQueryString; // ASURT 15355: Don't lose the query string if there is one. // In scriptless mobile HTML, we prepend __EVENTTARGET, et. al. to the query string. These have to be // removed from the form action. Use new HttpValueCollection to leverage ToString(bool encoded). if (!String.IsNullOrEmpty(queryString)) { action += "?" + queryString; } return(action); }
protected internal override void Render(HtmlTextWriter markupWriter) { WmlTextWriter writer = (WmlTextWriter)markupWriter; String targetUrl = Control.NavigateUrl; String text = Control.Text; if (text.Length == 0) { // Whidbey 18195 foreach (Control child in Control.Controls) { if (child is IStaticTextControl) { text = ((IStaticTextControl)child).Text; break; } else if (child is DataBoundLiteralControl) { text = ((DataBoundLiteralControl)child).Text; break; } } } String softkeyLabel = Control.SoftkeyLabel; if (softkeyLabel.Length == 0) { softkeyLabel = Control.Text; } writer.EnterStyle(Control.ControlStyle); // AUI 3652 targetUrl = Control.ResolveClientUrl(targetUrl); targetUrl = Control.GetCountClickUrl(targetUrl); // If cookieless mode is on, we need to apply the app path modifier for if the request is authenticated HttpContext context = HttpContext.Current; Debug.Assert(context != null); bool cookieless = CookielessHelperClass.UseCookieless(context, false, FormsAuthentication.CookieMode); if (cookieless && context.Request != null && context.Request.IsAuthenticated && context.Response != null) { targetUrl = context.Response.ApplyAppPathModifier(targetUrl); } PageAdapter.RenderBeginHyperlink(writer, targetUrl, false /* encode, Whidbey 111129 */, softkeyLabel, Control.AccessKey); String source = Control.ImageUrl; if (Control.ImageUrl != null && Control.ImageUrl.Length > 0) { writer.RenderImage(source, null /* localsource */, text /* alternateText */); } else { writer.Write(text); } PageAdapter.RenderEndHyperlink(writer); writer.ExitStyle(Control.ControlStyle); }