// GET: /Account/ExternalLoginCallback
[AllowAnonymous]
public async Task<ActionResult> ExternalLoginCallback(string returnUrl)
{
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
if (loginInfo == null)
{
return RedirectToAction("Login");
}
// Sign in the user with this external login provider if the user already has a login
var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent: false);
switch (result)
{
case SignInStatus.Success:
return RedirectToLocal(returnUrl);
case SignInStatus.LockedOut:
return View("Lockout");
case SignInStatus.RequiresVerification:
return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = false });
case SignInStatus.Failure:
default:
// If the user does not have an account, then prompt the user to create an account
ViewBag.ReturnUrl = returnUrl;
ViewBag.LoginProvider = loginInfo.Login.LoginProvider;
return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = loginInfo.DefaultUserName });
}
}
public class TimerModule : IHttpModule
{
static Timer timer;
long interval = 30000; //30 сек
static object synclock = new object();
static bool sent = false;
public void Init(HttpApplication app)
{
timer = new Timer(new TimerCallback(SendEmail), null, 0, interval);
}
private void SendEmail(object obj)
{
lock (synclock)
{
DateTime dd = DateTime.Now;
if (dd.Hour == 12 && dd.Minute == 13 && sent == false)
{
//что то делаем
sent = true;
}
else if (dd.Hour != 12 && dd.Minute != 13)
{
sent = false;
}
}
}
public void Dispose()
{ }
}
- <rewrite>
- <rules>
- <!-- BEGIN rule TAG FOR HTTPS REDIRECT
-->
- <rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="false" />
- <conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
- <!--
END rule TAG FOR HTTPS REDIRECT
!!!!!!!!!! If there are already other <rule> tags in your web.config, then place the copied <rule> tag before the other <rule> tags.
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00" />
</staticContent>
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9" />
<dynamicTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/json" enabled="true" />
<add mimeType="*/*" enabled="false" />
</dynamicTypes>
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/atom+xml" enabled="true" />
<add mimeType="application/xaml+xml" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
.................
@Html.ActionLink(item.TitleBL , "AphorismDetail", "Record", new { id = item.idBL }, null)
//и так
<a href="@Url.Action("Event", "Events", new { id = item.Event_Id })" title='item.Title'>@item.Title</a>
...
try
{
// Get parameters
int chunks = context.Request["chunks"] != null ? int.Parse(context.Request["chunks"]) : 1;
int chunk = context.Request["chunk"] != null ? int.Parse(context.Request["chunk"]) : 0;
string photoTempName = context.Request["name"] ?? string.Empty; //это уникальноеимя для файла
...
var myUniqueFileName = string.Format(@"{0}.txt", Guid.NewGuid());
System.IO.Path.GetRandomFileName()
public string GenerateFileName(string context)
{
return context + "_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + "_" + Guid.NewGuid().ToString("N");
}
filename1 = GenerateFileName("MeasurementData");
filename2 = GenerateFileName("Image");
<rewrite>
<rules>
<rule name="Redirect to non-www" stopProcessing="true">
<match url="(.*)" negate="false"></match>
<action type="Redirect" url="http://aforizmus.com/{R:1}"></action>
<conditions>
<add input="{HTTP_HOST}" pattern="^aforizmus\.com$" negate="true"></add>
</conditions>
</rule>
</rules>
</rewrite>