@@ -15,8 +15,8 @@ public class HomeController : Controller
15
15
{
16
16
17
17
ApplicationDbContext Db = new ApplicationDbContext ( ) ;
18
- CookieContainer Cookies = new CookieContainer ( ) ;
19
- public ActionResult ReqWithCookies ( )
18
+ //public CookieContainer Cookies = new CookieContainer();
19
+ /* public ActionResult ReqWithCookies()
20
20
{
21
21
//HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.foodiez.com.bd/Home/GetCityFromSession");
22
22
//request.CookieContainer = new CookieContainer();
@@ -29,7 +29,7 @@ public ActionResult ReqWithCookies()
29
29
Cookies.Add(new Cookie("PHPSESSID", "ktt4a4eue8cpq60evul997dia1") { Domain = target.Host });
30
30
31
31
32
- //cookies .Add(response.Cookies);
32
+ //Cookies .Add(response.Cookies);
33
33
34
34
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost/demo/userInformationView.php");
35
35
request.CookieContainer = Cookies;
@@ -40,17 +40,9 @@ public ActionResult ReqWithCookies()
40
40
string strResponse = reader.ReadToEnd();
41
41
42
42
return Json(strResponse, JsonRequestBehavior.AllowGet);
43
- }
43
+ }*/
44
44
45
- public CookieContainer GetCookie ( )
46
- {
47
- CookieContainer cookies = new CookieContainer ( ) ;
48
- Uri target = new Uri ( "http://localhost/demo/userInformationView.php" ) ;
49
- cookies . Add ( new Cookie ( "__RequestVerificationToken" , "05QKJgFJ8ZGk6KmgD1QR6RjeW1sHUwx5JGERq2NTUW0GXp7Hbu1Cs2cgQmkZ3-QFvynb876pKezKp-CvIoZmYF-8p28365lcvUK0be4eMf81" ) { Domain = target . Host } ) ;
50
- cookies . Add ( new Cookie ( "io" , "rVBILLp7745vDsrDAAAA" ) { Domain = target . Host } ) ;
51
- cookies . Add ( new Cookie ( "PHPSESSID" , "ktt4a4eue8cpq60evul997dia1" ) { Domain = target . Host } ) ;
52
- return cookies ;
53
- }
45
+
54
46
55
47
public ActionResult Index ( )
56
48
{
@@ -81,7 +73,7 @@ public ActionResult GetScriptContent()
81
73
} ) ;
82
74
}
83
75
}
84
- if ( s . Source != null && ! s . Source . Contains ( "facebook" ) && s . Content == null )
76
+ if ( s . Source != null && s . Content == null )
85
77
{
86
78
var withoutLoginContent = ExecuteHttpGet ( s . Source ) ;
87
79
var withLoginContent = ExecuteHttpGet ( s . Source , cookies ) ;
@@ -158,7 +150,40 @@ public ActionResult About()
158
150
return View ( ) ;
159
151
}
160
152
153
+
154
+ public string Cookies , TargetUrl ;
161
155
[ HttpPost ]
156
+ public ActionResult PostCookies ( string cookies , string url )
157
+ {
158
+ Cookies = cookies ;
159
+ TargetUrl = url ;
160
+
161
+
162
+ return null ;
163
+ }
164
+
165
+ public CookieContainer GetCookie ( )
166
+ {
167
+
168
+ Uri target = new Uri ( TargetUrl ) ;
169
+ var createdCookies = new CookieContainer ( ) ;
170
+
171
+ var splitWithSemicolon = Cookies . Split ( ';' ) ;
172
+ foreach ( var splitted in splitWithSemicolon )
173
+ {
174
+ var cookieValue = splitted . Split ( '=' ) ;
175
+ createdCookies . Add ( new Cookie ( cookieValue [ 0 ] . Trim ( ) , cookieValue [ 1 ] . Trim ( ) )
176
+ {
177
+ Domain = target . Host
178
+ } ) ;
179
+ }
180
+ return createdCookies ;
181
+ }
182
+
183
+
184
+
185
+
186
+ [ HttpPost ]
162
187
public ActionResult PostScript ( GenericScriptHolder genericScriptHolder )
163
188
{
164
189
ViewBag . Message = "Your contact page." ;
0 commit comments