Change A Cookie Value From A WebMethod ?

Oct 28, 2010

I have this:

[WebMethod]
public static void SetTheme(string theme)
{
Guid studentIdentifier = SessionData.LoggedInUser.Identifier;
Student student = (Student)ItemFactory.GetItem(studentIdentifier);
student.Theme = theme;
}

And I want to change the cookie that is also named "theme", at the end of this WebMethod. How can I accomplish that? The cookie has to be set here, not through JavaScript. That is a requirement.

View 1 Replies


Similar Messages:

State Management :: Updating Cookie / Change The Value In A Cookie?

May 10, 2010

I want to change the value in a cookie:
HttpCookie hc = new HttpCookie("HiddenColumns");
hc.Value = customView.HiddenFields;
hc.Expires = DateTime.Now.AddDays(365);
Response.SetCookie(hc);

Or this way:

Response.Cookies["HiddenColumns"].Value = customView.HiddenFields;;
Response.Cookies["HiddenColumns"].Expires = DateTime.Now.AddDays(365);

But when I retrieve the cookie value, it is still old, unless I do postback. I don't want to use Redirect.

View 2 Replies

Web Forms :: Change Data By Cookie?

Oct 13, 2010

i need to change the data by use cookie ,

this cookie is update by get param, i send the language and data suppose to updated to the correct culture.

my problame is that it happen only after i refresh by f5 key .

View 4 Replies

State Management :: Change Session Cookie Name?

Dec 15, 2010

I would like to change ASP.NET session cookie name "ASP.NET_Sessionid" to some other name. I specified <sessionState cookieName="MyCookieName" />. When I use fiddler to view response header, I can see "MyCookieName" with random generated number under cookie section, however, ASP.NET_SessionId also exist there.

View 2 Replies

Configuration :: Runtime Error On Cookie Value Change?

Nov 15, 2010

I am working on an ASP.Net web application running on framework 2.0. I have values stored in users cookie. During testing when the cookie value has been changed the asp.net runtime error page gets displayed.I have custom error mode set to On but somehow this error dosent get redirected. Can anyone tell me what I need to do/set for the custom error page to get displayed in this scenario?

Runtime ErrorDescription: An application error occurred on the server. The current customerror settings for this application prevent the details of the application
error from being viewed remotely (for security reasons). It could, however,
be viewed by browsers running on the local server machine.Details: To enable the details of this specific error message to be viewableon remote machines, please create a <customErrors> tag within a "web.config"configuration file located in the root directory of the current webapplication. This <customErrors> tag should then have its "mode" attributeset to "Off".

<!-- Web.Config Configuration File -->
<configuration>
<system.web>

[code]...

View 6 Replies

State Management :: Change Cookie Value Of Website?

Aug 28, 2010

I use cookie to change the language of my website.

When I click a LinkButton to change the language for first time it works but the other button doesn't work to change the language . I should delete cookie to change the language.

<asp:LinkButton ID="LinkButtonEn" runat="server" CommandArgument="en-US" OnCommand="LnkLang_Command" Text="English"></asp:LinkButton>
protected void LnkLang_Command(object sender, CommandEventArgs e)
{
Response.Cookies["mylang"].Value = "";
Response.Cookies["mylang"].Value = e.CommandArgument.ToString();
Response.Redirect("~/Default.aspx");
}

View 3 Replies

How To Expire Any Auto-login Cookie When User Change Password

Nov 3, 2010

I use ASP.NET Form Authentication method in my project to keep login information as user id in user's cookie like the below code. It works well without any problem.

FormsAuthentication.SetAuthCookie(userInfo.id.ToString(), model.AutoLogin);

But the problem occurs when user use automatic login and then he change his password. In some site, I see it will force you to re-login when you change password. It's quite easy for forcing current page to log out and re-login again.

But I don't find any nice idea for forcing other auto-login cookie in other browser to login again. I have some quite ugly idea for doing that but I don't like it.

Keep latest change password date in user data.

Put it in authentication cookie like the following code.

FormsAuthentication.SetAuthCookie(userInfo.id.ToString() + '|' + userInfo.ChangePasswordDate, model.AutoLogin);

View 1 Replies

AJAX :: ASPX WebMethod Not Running The WebService Webmethod Returning The Page?

May 19, 2010

I have a service that works great on my development box. It uses JQuery to hit my web service, and then the JSON results are sent back.

The web service is located on our basePage.cs. We didn't want to put out an external WebService for this. Our on beta box something different is happening.

The web page seems to be trying to call the web method correctly - the JSON data is being sent... but the server doesn't seem to know it's a webmethod. here's my service function (it's in our basepage.cs which inherits from Page).

[Code]....

View 2 Replies

State Management :: Remove Item (Cookie) From Basket (Cookie Collection)?

Sep 8, 2010

I am busy building a shopping cart with cookies. I have datalist which I populate from the cookies with a delete button next to each cookie

[Code]....

Now the problem is that when I hit the delete / remove button to expire the cookie, what happens when repopulating the datalist is that it shows the original cookie with all it's values as well as a new entry where all the values are blank.

View 3 Replies

WCF / ASMX :: Cookie Refuses To Get Set When Asking For A Cookie From Webservice

Jun 8, 2010

I'm trying to use a webservice that first expects the clients to login, to retrieve a cookie to re-use.
This is done through a login(string user, string pass) method on the webservice.

Doing this through a browser works fine, we get a cookie, and we can see the cookie via Fiddler or whatvever proxysniff thingy.

Time to do the same in ASP.Net, so we use the WSDL and generate a nice proxy class, and it works fine to call the login() method, but Never Ever does a cookie get set !

I already used the "cookiejar" technique - which means i create an instance of a CookieContainer and assign it to the proxyclass like this;

var cookies = new CookieContainer(3);

View 3 Replies

How To Find The Cookie In IEs Cookie-store

Jun 14, 2010

I am a bit baffled here; using IE7, ASP.NET 2.0 and Cassini (the VS built-in web server; although the same thing seems to be true for "real" applications deployed in IIS) I am looking for the session-id-cookie. My test page shows a session id (by printing out Session.SessionId) and Response.Cookies.Keys contains ASP.NET_SessionId. So far so good.

But I cannot find the cookie in IEs cookie-store! Nor does "remove all cookies" reset the session (as it does in FF)... So where - I am tempted to write that four letter word - does IE store that bloody cookie? Or am I missing something? By the way there is no hidden field with a session id either, as far as I can see. If I check in FF there is a cookie called ASP.NET_SessionId as I would expect. And as mentioned above deleting that cookie does start a new session; as I would expect.

View 1 Replies

Response.Cookie Client Or Server/where Does The Cookie Saved? On Client Machine Or Server Machine?

Mar 7, 2011

When calling Response.Cookie.Add(new HttpCookie("MyCookie", "objValue")); where does the cookie saved? on Client Machine or Server Machine?

EDIT:if saved in Client Machine, how can I read it from javascript then? I tried this kind of script.

function getCookie(c_name) {
var i, x, y, ARRcookies = document.cookie.split(";");
for (i = 0; i < ARRcookies.length; i++) {
[code].....

I cannot get the cookie that I saved from code behind. When I look into the document.cookie object, it is just an empty string.

Scenario:On Page_Init() on code behind. I create a cookie using Response.Cookie.Add(new HttpCookie("MyCookie", "cookieValue"));.
On Client side, I'm trying to read the cookie saved from code behind on page load using the snippet above, but it returns undefined

View 3 Replies

WebMethod Always Return XML?

Oct 12, 2010

ASP.NET [WebMethod] does it always return XML?

I know it can only return serializable data types.

View 1 Replies

Debug A VB.NET WebMethod?

Jan 21, 2011

I have an ASP.NET C# project consuming webservices and WebMethods are wrote in VB.NET with source code on a local IIS server. The WebMethod returns null, and I want to debug it to know why I get this.

if I set a breakpoint just before the webmethod call, I cant step into this webmethod.

So, how is the correct way to debug this webmethod?

View 2 Replies

Run A Webmethod With JQuery Asp.Net?

Mar 16, 2010

How do I run a webmethod with jQuery. Asp.Net
the method load it the GridView

[WebMethod]
public void GetGrid()
{
DataProviderDataContext db = new DataProviderDataContext();
GridView1.DataSource = db.Employees.ToList();
GridView1.DataBind();
[code]...

View 1 Replies

How To To Access The Session In A WebMethod

Dec 7, 2010

I have a pagemethod defined with the attribute [WebMethod]. The pagemethod accesses the session with no problem (HttpContext.Current.Session).

However I just read somewhere that in order to access the session in a WebMethod, you need to define it like so: [WebMethod(EnableSession=true)]

So my question is, what gives? How come I can access the session even though I dont have that code? Apparently EnableSession defaults to false if its missing, so I should not be able to access the session. The web application uses ASP.NET 3.5 and uses InProc Cookieless sessions.

View 5 Replies

C# - Get The Raw SOAP Request From Within A WebMethod?

Apr 6, 2010

How to get the raw SOAP request from within a WebMethod?

public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public int Add(int x, int y)
{
string request = getRawSOAPRequest();//How could you implement this part?
//.. do something with complete soap request
int sum = x + y;
return sum;
}
}

View 3 Replies

C# - NullReferenceException While Calling WebMethod?

Aug 24, 2010

I have the following problem;My console app is running on the server and all I want to do is control it over ASP.NET Web Service.

I added new ASP.NET Web Service project to my Solution where my main console app and added reference to it.The problem is every time WebMethod calls function from console app, i get the nullreferenceexception. Even if I try to use static classes or singletons; every object is null, although my console app is running absolutely correctly.

View 1 Replies

ResolveUrl In Static WebMethod?

Jun 23, 2010

How do you resolve a url like "../../images/test.png" to [URL] in a static asp.net web method?

View 2 Replies

Sending A String Value To The WebMethod?

Feb 7, 2011

function EmpCode(empCode) {
var queryString = "";
var hasQuerystring = document.URL.indexOf('?');

[code]...

View 1 Replies

Cannot Call Webmethod From JQuery

Nov 8, 2010

I cannot call webmethod from jquery. I think its about web.config file. How can i set web.config file for web services and webmethod?

View 1 Replies

Call WebMethod Using PowerShell?

Mar 31, 2010

It seems like ASP.NET WebMethods are not "web servicey" enough to work with New-WebServiceProxy. Or maybe it is, and I haven't figured out how to initialize it?

So instead, I tried doing it manually, like so:

$wc = new-object System.Net.WebClient
$wc.Credentials = [System.Net.CredentialCache]::DefaultCredentials
$url = "http://www.domenicdenicola.com/AboutMe/SleepLog/default.aspx/GetSpans"
$postData = "{`"starting`":`"/Date(1254121200000)/`",`"ending`":`"/Date(1270018800000)/`"}"
$result = $wc.UploadString($url, $postData)

But this gives me "The remote server returned an error: (500) Internal Server Error." So I must be doing something slightly wrong.

how to call my PageMethod from PowerShell, and not get an error?

View 2 Replies

How To Call WebMethod For Control In Javascript

Jan 27, 2011

I'm trying to call a WebMethod (GetData()) for a control in a web page using javascript.

<script type="text/javascript">
$(document).ready(function () {
//this selector needs fixed
$('<%= Control1.ClientID %>').GetData(); });
</script>
<tel:RadScriptManager ID="RadScriptManager1" runat="server" />
<tel:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
<uc1:Control ID="Control1" runat="server" />
</tel:RadAjaxPanel>

The uc:Control code:
[WebMethod()] [ScriptMethod()]
protected void LoadData() {
//stuff happens here }

I can't figure out what kind of selector to use. I have multiple controls on the page, and I want to call them at different times. What kind of selector or what command do I use to run this WebMethod?

View 4 Replies

AJAX :: AutoCompleteExtender Not Calling WebMethod

Sep 10, 2010

[Code]....
[Code]....

View 3 Replies

How To Pass A DateTime Value To A WebMethod (ASMX)

Jan 7, 2011

I have a WebMethod with a parameter defined as DateTime. When I call that webservice, I get this error:

[Code]....

Where 'start' and 'end' time are two javascript 'Date' objects.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved