我正在尝试从我的asp.net应用程序中设置持久性cookie。当我尝试使用IE浏览器存储值并尝试从Mozilla或Chrome浏览器获取值时,它无法正常工作。
我已将以下网址用于持久性Cookie。
URL: http://www.codeproject.com/Articles/31914/Beginner-s-Guide-To-ASP-NET-Cookies#9
并且我一直在使用以下代码:
09-08 19:15:39.578 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ isPlaying: no active player
09-08 19:15:39.578 27582-27582/com.myaudioservice.app V/MediaPlayer-JNI﹕ isPlaying: 0
09-08 19:15:39.578 27582-27582/com.myaudioservice.app V/MediaPlayer-JNI﹕ setAudioStreamType: 3
09-08 19:15:39.578 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ MediaPlayer::setAudioStreamType
09-08 19:15:39.578 27582-27582/com.myaudioservice.app E/com.myaudioservice.app.PlayerService﹕ Preparando: rtsp://domain/folder/file.stream
09-08 19:15:39.578 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ setVideoSurfaceTexture
09-08 19:15:39.578 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ prepareAsync
09-08 19:15:39.678 27582-31945/com.myaudioservice.app V/MediaPlayer-JNI﹕ isPlaying: 0
09-08 19:15:39.678 27582-31945/com.myaudioservice.app V/MediaPlayer-JNI﹕ reset
09-08 19:15:39.678 27582-31945/com.myaudioservice.app V/MediaPlayer﹕ reset
09-08 19:15:39.678 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ message received msg=1, ext1=0, ext2=0
09-08 19:15:39.688 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ notify(1, 0, 0) callback on disconnected mediaplayer
09-08 19:15:39.688 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ message received msg=8, ext1=0, ext2=0
09-08 19:15:39.688 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ notify(8, 0, 0) callback on disconnected mediaplayer
09-08 19:15:39.688 27582-27582/com.myaudioservice.app E/com.myaudioservice.app.PlayerService﹕ stop()
09-08 19:15:39.798 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ isPlaying: no active player
09-08 19:15:39.798 27582-27582/com.myaudioservice.app V/MediaPlayer-JNI﹕ isPlaying: 0
09-08 19:15:39.808 27582-27582/com.myaudioservice.app V/MediaPlayer-JNI﹕ setAudioStreamType: 3
09-08 19:15:39.808 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ MediaPlayer::setAudioStreamType
09-08 19:15:39.808 27582-27582/com.myaudioservice.app E/com.myaudioservice.app.PlayerService﹕ Preparando: rtsp://domain/folder/file.stream
09-08 19:15:39.808 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ setVideoSurfaceTexture
09-08 19:15:39.808 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ prepareAsync
09-08 19:15:39.938 27582-31952/com.myaudioservice.app V/MediaPlayer-JNI﹕ isPlaying: 0
09-08 19:15:39.938 27582-31952/com.myaudioservice.app V/MediaPlayer-JNI﹕ reset
09-08 19:15:39.938 27582-31952/com.myaudioservice.app V/MediaPlayer﹕ reset
09-08 19:15:39.938 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ message received msg=1, ext1=0, ext2=0
09-08 19:15:39.938 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ notify(1, 0, 0) callback on disconnected mediaplayer
09-08 19:15:39.938 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ message received msg=8, ext1=0, ext2=0
09-08 19:15:39.938 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ notify(8, 0, 0) callback on disconnected mediaplayer
09-08 19:15:39.948 27582-27582/com.myaudioservice.app E/com.myaudioservice.app.PlayerService﹕ stop()
09-08 19:15:40.069 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ isPlaying: no active player
09-08 19:15:40.069 27582-27582/com.myaudioservice.app V/MediaPlayer-JNI﹕ isPlaying: 0
09-08 19:15:40.079 27582-27582/com.myaudioservice.app V/MediaPlayer-JNI﹕ setAudioStreamType: 3
09-08 19:15:40.079 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ MediaPlayer::setAudioStreamType
09-08 19:15:40.079 27582-27582/com.myaudioservice.app E/com.myaudioservice.app.PlayerService﹕ Preparando: rtsp://domain/folder/file.stream
09-08 19:15:40.079 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ setVideoSurfaceTexture
09-08 19:15:40.079 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ prepareAsync
09-08 19:15:40.179 27582-31957/com.myaudioservice.app V/MediaPlayer-JNI﹕ isPlaying: 0
09-08 19:15:40.179 27582-31957/com.myaudioservice.app V/MediaPlayer-JNI﹕ reset
09-08 19:15:40.179 27582-31957/com.myaudioservice.app V/MediaPlayer﹕ reset
09-08 19:15:40.179 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ message received msg=1, ext1=0, ext2=0
09-08 19:15:40.189 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ notify(1, 0, 0) callback on disconnected mediaplayer
09-08 19:15:40.189 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ message received msg=8, ext1=0, ext2=0
09-08 19:15:40.189 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ notify(8, 0, 0) callback on disconnected mediaplayer
09-08 19:15:40.189 27582-27582/com.myaudioservice.app E/com.myaudioservice.app.PlayerService﹕ stop()
09-08 19:15:40.289 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ isPlaying: no active player
09-08 19:15:40.289 27582-27582/com.myaudioservice.app V/MediaPlayer-JNI﹕ isPlaying: 0
09-08 19:15:40.299 27582-27582/com.myaudioservice.app V/MediaPlayer-JNI﹕ setAudioStreamType: 3
09-08 19:15:40.299 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ MediaPlayer::setAudioStreamType
09-08 19:15:40.299 27582-27582/com.myaudioservice.app E/com.myaudioservice.app.PlayerService﹕ Preparando: rtsp://domain/folder/file.stream
09-08 19:15:40.299 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ setVideoSurfaceTexture
09-08 19:15:40.299 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ prepareAsync
09-08 19:15:40.429 27582-31966/com.myaudioservice.app V/MediaPlayer-JNI﹕ isPlaying: 0
09-08 19:15:40.429 27582-31966/com.myaudioservice.app V/MediaPlayer-JNI﹕ reset
09-08 19:15:40.429 27582-31966/com.myaudioservice.app V/MediaPlayer﹕ reset
09-08 19:15:40.429 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ message received msg=1, ext1=0, ext2=0
09-08 19:15:40.429 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ notify(1, 0, 0) callback on disconnected mediaplayer
09-08 19:15:40.429 27582-27582/com.myaudioservice.app E/com.myaudioservice.app.PlayerService﹕ stop()
09-08 19:15:40.429 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ message received msg=8, ext1=0, ext2=0
09-08 19:15:40.429 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ notify(8, 0, 0) callback on disconnected mediaplayer
09-08 19:15:40.549 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ isPlaying: no active player
09-08 19:15:40.549 27582-27582/com.myaudioservice.app V/MediaPlayer-JNI﹕ isPlaying: 0
09-08 19:15:40.559 27582-27582/com.myaudioservice.app V/MediaPlayer-JNI﹕ setAudioStreamType: 3
09-08 19:15:40.559 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ MediaPlayer::setAudioStreamType
09-08 19:15:40.559 27582-27582/com.myaudioservice.app E/com.myaudioservice.app.PlayerService﹕ Preparando: rtsp://domain/folder/file.stream
09-08 19:15:40.559 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ setVideoSurfaceTexture
09-08 19:15:40.559 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ prepareAsync
09-08 19:15:40.659 27582-31972/com.myaudioservice.app V/MediaPlayer-JNI﹕ isPlaying: 0
09-08 19:15:40.659 27582-31972/com.myaudioservice.app V/MediaPlayer-JNI﹕ reset
09-08 19:15:40.659 27582-31972/com.myaudioservice.app V/MediaPlayer﹕ reset
09-08 19:15:40.659 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ message received msg=1, ext1=0, ext2=0
09-08 19:15:40.659 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ notify(1, 0, 0) callback on disconnected mediaplayer
09-08 19:15:40.659 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ message received msg=8, ext1=0, ext2=0
09-08 19:15:40.659 27582-27596/com.myaudioservice.app V/MediaPlayer﹕ notify(8, 0, 0) callback on disconnected mediaplayer
09-08 19:15:40.669 27582-27582/com.myaudioservice.app E/com.myaudioservice.app.PlayerService﹕ stop()
09-08 19:16:01.281 27582-27582/com.myaudioservice.app D/AbsListView﹕ onDetachedFromWindow
09-08 19:16:01.311 27582-27582/com.myaudioservice.app E/com.myaudioservice.app.PlayerService﹕ stop()
09-08 19:16:01.311 27582-27582/com.myaudioservice.app V/MediaPlayer-JNI﹕ release
09-08 19:16:01.311 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ setListener
09-08 19:16:01.311 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ disconnect
09-08 19:16:01.311 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ destructor
09-08 19:16:01.311 27582-32148/com.myaudioservice.app W/dalvikvm﹕ threadid=14: thread exiting with uncaught exception (group=0x4193eda0)
09-08 19:16:01.311 27582-27582/com.myaudioservice.app V/MediaPlayer﹕ disconnect
09-08 19:16:01.321 27582-32148/com.myaudioservice.app E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-15992
Process: com.myaudioservice.app, PID: 27582
java.lang.IllegalStateException
at android.media.MediaPlayer.isPlaying(Native Method)
at com.myaudioservice.app.PlayerService$1.run(PlayerService.java:129)
at java.lang.Thread.run(Thread.java:841)
你们可以帮我解决这个问题吗?
谢谢, 暗部
答案 0 :(得分:1)
不,浏览器无法访问Cookie。持久性cookie是一种cookie,在浏览器关闭时不会消失。浏览器负责管理它存储的cookie,每个浏览器都可以有独立的存储方式。
更重要的是 - 我认为这篇文章有点过时了,请查看以下链接获取“新鲜”信息 - MSDN
答案 1 :(得分:0)
Cookie取决于浏览器。 Cookie的主要目的是在客户端或特定客户端存储一些数据。
1.是否可以在所有浏览器中获得相同的持久性Cookie值?
不,如果您想在不同的浏览器上访问某些值,那么您应该转到服务器端。
2.持久性cookie是否与浏览器无关?
不,它们取决于浏览器。它们将仅保留在您访问过您网页的浏览器上。我认为你对持久性感到困惑。
持久性表示您定义了Cookie存在的持续时间。在此之后,它将被浏览器删除。