.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to send and receive unique cookie to a user

Posted By:      Posted Date: October 10, 2010    Points: 0   Category :ASP.Net

Hi, I need to send a cookie to the my web site's visitors and receive them back for information. For example when machine1 visits my site if not set I set a cookie with "user1", for machine2 I set "user2" etc. 

Actually I need to retrieve the cookie back from my log file, so I thought if I do this it will be saved to my log file. Any help?

Thanks in advance

View Complete Post

More Related Resource Links

Web Service that will receive xml request and send xml response


I am trying to create a web service that can do the following functionality:

Request XML 

<?xml version="1.0" encoding="UTF-8"?>
<Authentication UserName="test" Password="test" MyId="0987">

Response XML - After authenticating request xml from client send them back the following response:

<?xml version="1.0" encoding="UTF-8"?>
   <Test MyId="0987">
       <TestType id="11"></TestType>
       <TestType id="22"></TestType>

How can I create web service to do this.

Send an Email with User fields data entered in the form


Hi All,

          I have a form which have some user input fields(like textboxes,dropdownlists,textarea etc) fields and a submit button.

on click i need to send email with body contents as all the details entered by user in the form

Can anyone suggest how i should approach to this in sharepoint..

any code examples would be appreciated.


User Control not accessing the value of the properties send to it from the aspx page.


I have a dynamic accordion on a page. Set its datasource to an object of paged data source.The user control is in the accordions content template. When i was writing code the properties were showing but after giving the values of databases as


<uc:UserControl1  runat="server" Property1='<%#DataBinder.Eval(Container.DataItem,"columname1")%>' Property2='<%#DataBinder.Eval(Container.DataItem,"columname2")%>'  ></uc:UserControl1>


but the values shows null, these properties are shown as textboxes text property by user control.

MoreOver when I checked the values of database Items.So i made a textbox instead of usercontrol here as

<asp:TextBox ID="txtTest" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Columname1")%>'></asp:TextBox>

It is showing the correct value. And if i pass the value directly it is also showing correctly like

<uc:UserControl1  runat="server" Property1="XYZ")%>' Property2="ABC")%>'  ></uc:UserControl1>

. where I am wrong

the problem is eval is not passing the value to usercont

Send/Receive SMS

I dont know whether this is the right place to post this. I have a situation here. I am new to .NET. I need to send/receive SMS using a vision COM , AT commands and a modem is involved in this. I am supposed to come up with an idea on how to implement this function in my project. Can some one help me out in this?

Programatically Send and receive data using Post Method

Hi,I wish to make a script which programatically send the POST data to one server and then the other server receive the POST message and retrieve the information. How should make this work? I already successfully write the sender site, the code as follow:string postData = "id=0&co=5";ASCIIEncoding encode = new ASCIIEncoding();         //data encoding         byte[] dataEncode = encode.GetBytes(postData);         //end ascii encoding scheme         string url = "http://localhost:51711/Handler1.ashx"; //         //web request         HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);         req.Method = "POST";         req.ContentType = "application/x-www-form-urlencoded";         req.ContentLength = dataEncode.Length;         //send data                Stream st = req.GetRequestStream();         st.Write(dataEncode, 0, dataEncode.Length);         st.Close();ASCIIEncoding encode = new ASCIIEncoding();byte[] dataEncode = encode.GetBytes(postData);stri

How to Send/ Receive Class/Structures with TCP using C# .Net...

Here I am looking out for 2-things! 1) A pointer/ notes on how to send/ receive data (a class object or structure) across the network using TCP/ UDP between 2-Windows machines. 2) However, the higher priority thing for me, as of now, is sending/ receiving data (a class object or structure) across the network between a WinXP machine(client-application) and Linux machine (the server application). Working with ‘unmanaged code/ WinSock APIs’ will be the only solution? <Note-1> Here, I am NOT looking to transfer the file/s OR FTP or something similar. Its purely objects/ structures. <Note-2> A cursory look suggested that NetworkStream and BinaryWriter can help me achieving data transfer between Windows PCs. _______________________________________________________________ Say, an example structure I need to Send/ Receive across is:     public struct Message2Linux {   public int MsgId;   public int paramCount;   public int[] paramArray; };     Many thanks in advance.

Catch when user login cookie has expired. How to?



I have an ASP.NET MVC application that uses the Forms Authentication. I have the following configuration block inside the Web.Config:

<authentication mode="Forms">
  <forms loginUrl="~/Login/LogOn" name=".td_gsl_login_cookie" timeout="10" slidingExpiration="true" />

So if the user does not click any link for 10 minutes it will be disconnected and redirected to the LogOn action at the next click. This works very fine in my app.

Now what is really annoying is that I have some links in my app that open up a modal popup window (using jQuery UI) who retrieves their content dinamically using ajax requests and if the user click on one of these links after his login timeout has expired the result is that the login page is showed inside the popup dialog. The effect is really bad...

I understand that developing a script to check if the user is still connected would slide the cookie expiration.

Do you have any suggestion on how to address this behaviour?

thanks for helping






The user does not exist or is not unique


We have just used the following link to update our object cache user accounts and after IISRESET we are now getting the above message, and are unable to access our intranet site.

We created two new AD accounts with minimal network privileges, as these would be defined within the Central Admin, as either Full Control or Full Read.

Has anyone else updated their Cache Users and did they have a similar problem, did they create new AD accounts for this or use existing ones?

Quick turn around would be nice, how can I tell what setting has been made within powershell for the portalsuperuseraccount and portalsuperreaderaccount.


What is the best method of leaving a cookie on a users machine and then looking it up when the user


I want to store a users dialect in a cookie on his machine, and then look it up before loading the version of my web app.  What is the code to do that.


SPD workflow doesn't send email to user in list when automatically started

Hi all,

My first post here and I hope someone out there could kindly help. I recently found out a strange issue with my SPD workflow. Basically, it couldn't send out email if (1) the recipient resides in the list and (2) the workflow is automatically started.

For example, I have a list with a "user" field. A workflow first "Send an email" to this user, and then "Collect data from a user" from this user. If the workflow is set to start automatically, then this user gets no email. Tasks list does contain a task, but the "Assigned To" field of the task is empty. This is the case no matter if the user field is of type "Single line of text" or "Person or Group".

Everything's fine if I manually start the workflow. And everything's fine if the user is directly spelled out (jay@company.com) in the "Send an email" and "Collect data from a user" actions instead of retrieved from the list. Either case the user would get two emails as expected, and the "Assigned To" field would display the user name properly.

I looked into the log but didn't find anything special. As you can imagine, this is breaking a lot of our workflows and making SPD workflow look very bad. It's just not

Can not send SharePoint alerts to the user outside domain

The SharePoint alerts would not go outside company domain. We have many partners users (some have active directory account and some are only in exchange 2007 contacts) and none of them recieve alerts. The internal users recieve alerts no problem there. I have setup relay in exchange 2007. From SharePoint webserver I can telnet/smtp to exchange on port 25 and able to send message. Not sure where  is the problem? can any one help?

calendar - incoming email error - The user does not exist or is not unique..


I am sending calendar appointments to a sharepoint calendar.  It works fine if i send from my exchange email on the domain.  However if i try to send from outlook, which has a gmail (live account same error) account off network, the mail comes to the drop folder on my incoming email sharepoint server but then i get this error:

An error occurred while processing the incoming e-mail file C:\inetpub\mailroot\Drop\4ab7332801cb38a6000000c7.eml. The error was: The user does not exist or is not unique..

next error is

The Incoming E-Mail service has completed a batch.  The elapsed time was 00:00:00.0625004.  The service processed 1 message(s) in total.  Errors occurred processing 1 message(s): Message ID: <000001cb38a5$00a4f100$01eed300$@com>

external users can just find send email and documents to other document libraries but this calendar is giving me problems.

all servers sharepoint 2007 sp2 enterprise edition.


The user does not exist or is not unique


Hi Guys ,

  When i create a new group in sharepoint it gives me the this error

 The user does not exist or is not unique

I also cannot add add users.

I can create groups using stsadm -o creategroup .


Please help


I want to send user to different pages based on their roles



I'm using the built-in membership controls and classes to manage authorization and authentication in my app.

Here's what I want to do:

If the user is in "Manager" role, I want to send him/her to the manager page no matter where he/she came from .

If the user is in "Supervisor" role, I want to send him/her to supervisor page no matter where he/she came from.

However, if the user is not in any role, just a registered member, I want to send him/her back to where he/she came from as stated in ReturnUrl. If no, ReturnUrl is specified, I will send him/her to the home page.

On my login page, I'm using the Login server control but in my code behind, there's no method wired to the control because the control takes care of everything.

I assume I need to add a method and wire it to the submit button, is that right? If so, I'll have to really handle the login event which means I'll need more info about how to do that. So I'd appreciate some pointers in how to do that. Thanks.

Pick with receive/send reply behavior

Hi all,

I have this workflow (simplified view):

				<Receive CanCreateInstance="True"/>

The LongRunningActivity is a code activity which runs another workflow [through Task.Factory.StartNew(() => workflowApplication.Run())] and waits with a ManualResetEvent the completion of the inner workflow. The inner workflow contains other receive activities.
This is the Execute code of the LongRunningActivity CodeActivity:

WaitHandle waitHandle = new ManualResetEvent(false);
        // ...
        WorkflowApplication workflowApplication = new WorkflowApplication(definition);
        workflowApplication.Completed = args =>
        Task.StartNew(() => workflowApplication.Run());

When I run it, I have the same behavior:

password reset in asp.net mvc - cannot send the e-mail to user !


hi guys, 

I am unable to send the e-mail afetr password reset in an asp.net mvc 3 application. I used the below code to reset the password;


it reset the password but didn't send the e-mail.

how can I implement password reset in an asp.net mvc app?

Get the unique session for the user



Here's my scenario, a user logs in to the sharepoint site and visits a document library, then I have this webpart that gets the username of the user and stores it in the database, however, my problem is that whenever the user refreshes the browser(press F5), another session ID is thrown to the user meaning, my code will again put the username to the database and it will now have 2 data/record in my database.

What I want to do is that whenever a user visits a document library, the username will be stored in the database once, or until he logs out or after a certain amount of time. and if the user refreshes his browser(press F5) it will not count as a view/hit therefore, the username will not be stored to the database.

I've been trying this with alot of if statements however I cant find a way to handle this. I think i really need your help again.



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend