Click here to Skip to main content
15,886,919 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionAsp.Net MVC Pin
Ankit Bopche28-Mar-18 5:42
Ankit Bopche28-Mar-18 5:42 
AnswerRe: Asp.Net MVC Pin
Richard Deeming28-Mar-18 8:01
mveRichard Deeming28-Mar-18 8:01 
GeneralRe: Asp.Net MVC Pin
Ankit Bopche28-Mar-18 8:25
Ankit Bopche28-Mar-18 8:25 
GeneralRe: Asp.Net MVC Pin
Ankit Bopche28-Mar-18 8:34
Ankit Bopche28-Mar-18 8:34 
GeneralRe: Asp.Net MVC Pin
Richard Deeming28-Mar-18 9:05
mveRichard Deeming28-Mar-18 9:05 
QuestionEnable Image Zoom only Pin
sunsher28-Mar-18 3:24
sunsher28-Mar-18 3:24 
AnswerRe: Enable Image Zoom only Pin
User 418025431-Mar-18 15:20
User 418025431-Mar-18 15:20 
QuestionHttpCookie vs Cookie, and multi-value HttpCookie Pin
jkirkerx25-Mar-18 12:55
professionaljkirkerx25-Mar-18 12:55 
I don't get it here. I've always used HttpCookies to store multiple values in them
But using Cookie, it seems you can only store 1 value.

What I'm trying to do:
I have a mvc view called Bug Report. You click the button and it runs the Diag Controller with an action that uses HttpWebRequest and prior was WebClient. I changed it to transmit a cookie in the header, because WebClient was too basic.

On the page that is getting read, I have an home made security attrubute that uses OnActionExecuting and the ActionExecutingContext. If the request doesn't contain the session variable, it gets kicked out to Logout.

So to the best of my research, you can make a cookie container with multiple cookies.
This works fine, but I wanted to refine it more...
With HttpCookies, I can send 1 cookie with the 4 values, but with cookie, I have to send each cookie separate. I don't understand this part.
CookieContainer container = new CookieContainer();<br />
container.Add(new Cookie("a", httpCookie["a"]) { Domain = target.Host });
container.Add(new Cookie("b", httpCookie["b"]) { Domain = target.Host });
container.Add(new Cookie("c", httpCookie["c"]) { Domain = target.Host });
container.Add(new Cookie("d", "true") { Domain = target.Host });

var webRequest = (HttpWebRequest)WebRequest.Create(rUrl);
webRequest.CookieContainer = container;
using (var response = (HttpWebResponse)webRequest.GetResponse())
{
    model.Page_HTML = response.ToString();
}

So I wrote this, the main cookie, but I can't figure out how to store 4 records in it.
Cookie cookie = new Cookie() {
   Name = "Main",
   Expires = DateTime.Now.AddMinutes(1),
   Domain = target.Host,
   HttpOnly = true,
   Secure = true
}; 

On the OnActionExecuting side, I figured how to read the cookies. But it seems sort or silly to read 4 cookies. It looks like on this side I can just read a HttpCookie of any format.
HttpCookie cookie_A = filterContext.RequestContext.HttpContext.Request.Cookies.Get("a");

So my question is:
Am I beating a dead horse with a stick here and I should just be happy that the 4 cookies work?
If it ain't broke don't fix it

AnswerRe: HttpCookie vs Cookie, and multi-value HttpCookie Pin
Richard Deeming26-Mar-18 8:37
mveRichard Deeming26-Mar-18 8:37 
GeneralRe: HttpCookie vs Cookie, and multi-value HttpCookie Pin
jkirkerx5-Apr-18 12:24
professionaljkirkerx5-Apr-18 12:24 
QuestionNeed to loop through Kendo grid to get the selected value of all the Dropdowns in the Grid Pin
indian14320-Mar-18 14:09
indian14320-Mar-18 14:09 
AnswerRe: Need to loop through Kendo grid to get the selected value of all the Dropdowns in the Grid Pin
Vincent Maverick Durano20-Mar-18 17:40
professionalVincent Maverick Durano20-Mar-18 17:40 
GeneralRe: Need to loop through Kendo grid to get the selected value of all the Dropdowns in the Grid Pin
indian14320-Mar-18 20:44
indian14320-Mar-18 20:44 
GeneralRe: Need to loop through Kendo grid to get the selected value of all the Dropdowns in the Grid Pin
Richard Deeming21-Mar-18 9:24
mveRichard Deeming21-Mar-18 9:24 
GeneralRe: Need to loop through Kendo grid to get the selected value of all the Dropdowns in the Grid Pin
indian14321-Mar-18 10:07
indian14321-Mar-18 10:07 
GeneralRe: Need to loop through Kendo grid to get the selected value of all the Dropdowns in the Grid Pin
indian14321-Mar-18 7:29
indian14321-Mar-18 7:29 
Questionhow to find a running total in a gridView templateField Pin
Member 933127820-Mar-18 12:40
Member 933127820-Mar-18 12:40 
AnswerRe: how to find a running total in a gridView templateField Pin
Vincent Maverick Durano20-Mar-18 17:35
professionalVincent Maverick Durano20-Mar-18 17:35 
QuestionPage.RegisterStartupScript Method Pin
A_Griffin16-Mar-18 2:23
A_Griffin16-Mar-18 2:23 
AnswerRe: Page.RegisterStartupScript Method Pin
Richard Deeming16-Mar-18 2:46
mveRichard Deeming16-Mar-18 2:46 
GeneralRe: Page.RegisterStartupScript Method Pin
A_Griffin16-Mar-18 2:54
A_Griffin16-Mar-18 2:54 
AnswerRe: Page.RegisterStartupScript Method Pin
F-ES Sitecore19-Mar-18 0:24
professionalF-ES Sitecore19-Mar-18 0:24 
QuestionSCHEDULER IN VISUAL STUDIOS Pin
Faisal716-Mar-18 1:26
Faisal716-Mar-18 1:26 
AnswerRe: SCHEDULER IN VISUAL STUDIOS Pin
Vincent Maverick Durano20-Mar-18 17:57
professionalVincent Maverick Durano20-Mar-18 17:57 
GeneralRe: SCHEDULER IN VISUAL STUDIOS Pin
Faisal721-Mar-18 3:00
Faisal721-Mar-18 3:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.