16,004,761 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Gaurav Gupta A Tech Guy (Top 49 by date)
Gaurav Gupta A Tech Guy
7-Apr-20 0:47am
View
Using HttpPost method as per below code:-
public string PreparePOSTForm(System.Web.UI.Page myPage, string formID, string url, System.Collections.Hashtable data) // post form
{
//Set a name for the form
//string formID = "PostForm";
//Build the form using the specified data to be posted.
StringBuilder strForm = new StringBuilder();
strForm.Append("");
foreach (System.Collections.DictionaryEntry key in data)
{
strForm.Append("");
}
strForm.Append("");
//Build the JavaScript which will do the Posting operation.
StringBuilder strScript = new StringBuilder();
strScript.Append("");
strScript.Append("var v" + formID + " = document." +
formID + ";");
strScript.Append("v" + formID + ".submit();");
strScript.Append("");
//Return the form and the script concatenated.
//(The order is important, Form then JavaScript)
myPage.Controls.Add(new LiteralControl(strForm.ToString() + strScript.ToString()));
return strForm.ToString() + strScript.ToString();
}
Gaurav Gupta A Tech Guy
20-Jul-18 1:27am
View
is there any way to access a digital certificate on client machine and able to sign PDF document genrated on web server ? If USB token is on web server than i can do it but if digital certificate is stored in USB token attached in client machine than how can we do it ?
Gaurav Gupta A Tech Guy
20-Jul-18 1:27am
View
I want my web application which is hosted on remote server be able to read digital certificate from client machine which have USB token in thier PC.
Gaurav Gupta A Tech Guy
20-Jul-18 1:26am
View
Deleted
is there any way to access a digital certificate on client machine and able to sign PDF document genrated on web server ? If USB token is on web server than i can do it but if digital certificate is stored in USB token attached in client machine than how can we do it ?
Gaurav Gupta A Tech Guy
20-Jul-18 1:24am
View
Deleted
I want my web application which is hosted on remote server be able to read digital certificate from client machine which have USB token in thier PC.
Gaurav Gupta A Tech Guy
3-Mar-17 6:37am
View
thanks for your advice and your valuable time.......
Gaurav Gupta A Tech Guy
6-Jan-17 4:56am
View
i have aspx page which contain form tag by default. but there is need to put a form tag to post data.
Gaurav Gupta A Tech Guy
8-Dec-15 2:11am
View
Yes, i only need to consume WCF Services on multiple platform like android app ? So restful WCF would be best way or not ? Also i want to implement some security work. so please help me with example in that way as well....
Gaurav Gupta A Tech Guy
6-Jul-15 0:51am
View
Please see my question again. i have improved my question for better understanding. you will see that the problem is something else.
Gaurav Gupta A Tech Guy
4-Jul-15 6:40am
View
Problem with is that rewriting is working for dynamic items of asp.net but not for images, js, css files etc. when rewriting is done, it is taking url of content from root domain (http://www.mywebsite.com/mycss.css), it is not including sub domain path (http://www.mywebsite.com/en/mycss.css ).
Gaurav Gupta A Tech Guy
28-Jun-15 0:57am
View
Thank you for suggestion...
Gaurav Gupta A Tech Guy
26-Jun-15 1:46am
View
Please help me ?
Gaurav Gupta A Tech Guy
26-Jun-15 1:43am
View
Please help me ?
Gaurav Gupta A Tech Guy
23-Jun-15 1:03am
View
ok..
Gaurav Gupta A Tech Guy
22-Jun-15 9:33am
View
Please help me out now?
Gaurav Gupta A Tech Guy
18-Mar-15 2:35am
View
is there no one who can answer my questions ?
Gaurav Gupta A Tech Guy
3-Mar-15 0:36am
View
Nothing found, could not able to resolve. it might be some setting needs to enable at IIS level or configuration level...
Gaurav Gupta A Tech Guy
2-Mar-15 8:25am
View
error is same as above mentioned. As much i know, it is the problem of IIS level setting. there might be iis not allowing http://192.168.0.53/mysite/pages/agra
url to parse.
one more thing when i hosted my site on Windows 2012 server then it works. but not on Windows server 2008 R2.
Gaurav Gupta A Tech Guy
27-Feb-15 23:43pm
View
when you use tiny mce 4 editor. and go to tools menu and choose source code option and paste above html then it removes span tag in h1 tag.
You can see it at http://www.tinymce.com/ for live example.
Gaurav Gupta A Tech Guy
23-Jan-15 7:24am
View
i already removed www...
Gaurav Gupta A Tech Guy
23-Jan-15 5:40am
View
actually i am getting error while typing https://www.mywebsite.com. if i type https://mywebsite.com then i works fine.
Gaurav Gupta A Tech Guy
23-Jan-15 2:19am
View
//if ((firstLine.IndexOf("JFIF") > -1) || (firstLine.IndexOf("Exif") > -1))
//{
if (Request.ContentLength <= 300 * 1024)
{
//if (System.IO.File.Exists(dirPath + fileURl + cirfileName + "." + cirextn))
//{
// System.IO.File.Delete(dirPath + fileURl + cirfileName + "." + cirextn);
//}
//uploadedfile.SaveAs(context.Server.MapPath(dirPath + "/" + fileSave));
//byte[] sr = context.Request.BinaryRead(context.Request.ContentLength);
fs.Seek(0, SeekOrigin.Begin);
Stream inputStream = Request.InputStream;
if (System.IO.File.Exists(dirPath + fileURl + cirfileName + "." + cirextn))
{
System.IO.File.Delete(dirPath + fileURl + cirfileName + "." + cirextn);
}
FileStream fs1 = System.IO.File.Create(dirPath + fileURl + cirfileName + "." + cirextn);
Request.InputStream.CopyTo(fs1);
//stu_imageMBA = new Byte[Request.ContentLength];
//fs.Read(stu_imageMBA, 0, stu_imageMBA.Length);
//fs1.Write(stu_imageMBA, 0, stu_imageMBA.Length);
fs1.Close();
//Bitmap bt = new Bitmap(inputStream);
//bt.Save(context.Server.MapPath(dirPath + "/" + fileSave), ImageFormat.Jpeg);
//context.Session["Cat"] = true;
//return "{success:true, name:\"" + FileName + "\", path:\"" + Filepath + "\"}";
Session["IsSignFound"] = "1";
return "{success:true, imsg:\"Selected file is uploaded.\", name:\"" + filename + "\", path:\"" + fileURl2.Substring(1, fileURl2.Length - 1) + cirfileName + "." + cirextn + "\", spath:\"" + fileURl2 + cirfileName + "." + cirextn + "\", filetype:\"" + Request.ContentType + "\"}";
}
else
{
//return "Image size can not exceed " + size.ToString() + "kb in ";
return "{success:false, imsg:\"Image size can not exceed 100 kb in Signature file.\"}";
}
}
}
else
{
//return "Please upload .jpg or .jpeg file in ";
return "{success:false, imsg:\"Please upload .jpg or .jpeg file in Signature.\"}";
}
}
else
{
//return "Please upload .jpg or .jpeg file in ";
return "{success:false, imsg:\"Please upload .jpg or .jpeg file in Signature.\"}";
}
//f1.CircularURL = fileURl + fileName + extn;
//f1.CircularFileName = fileName;
//f1.CircularContentType = uploadFile.ContentType;
//myfile.Add(f1);
}
catch (Exception ex)
{
return "{success:false, imsg:\"Selected file is not uploaded. Please try again.\"}";
}
}
return "{success:false, imsg:\"Selected file is not uploaded. Please try again.\"}";
Gaurav Gupta A Tech Guy
23-Jan-15 2:16am
View
below is the code..
i call it with a javascript funtion for google like upload u=in which it start uploading just after file selection using fileuploader.js file..
public string UploadSign(HttpPostedFileBase uploadFile, Int64 candid)
{
//List<circularfilemodel> myfile = new List<circularfilemodel>();
Int64 candidateid = 0;
string examType = "", status = "", challanNo = "";
try
{
candidateid = Convert.ToInt64(Session["CandidateID"]);
examType = Convert.ToString(Session["ExamType"]);
}
catch (Exception ex)
{
}
//string challanNo = "0";
bool isContup = false;
challanNo = candidateid.ToString() + "_" + examType;
isContup = true;
if (Request.ContentLength > 0 && isContup == true && candidateid >= 1 && candidateid == candid)
{
//CircularFileModel f1 = new CircularFileModel();
DateTime tm = DateTime.Now;
//string filename = Request.QueryString[0];
string filename = Request.QueryString["qqfile"];
string dirPath = AppDomain.CurrentDomain.BaseDirectory;
string fileURl = "./Content/writereaddata/Annual2015/";
string fileURl2 = "Content/writereaddata/Annual2015/";
if (Directory.Exists(dirPath + fileURl) == false)
{
Directory.CreateDirectory(dirPath + fileURl);
}
string cirfileName = challanNo.ToString() + "_Sign";
//string cirextn = Path.GetExtension(filename);
string cirextn = "jpg";
try
{
String fn = Path.GetFileNameWithoutExtension(filename);
String ext = Path.GetExtension(filename);
char[] SpecialChars = "!@#$%^&*()+=~`\\|/?><,\"".ToCharArray();
int indexOf = fn.IndexOfAny(SpecialChars);
String fileName1 = fn;
int count = fileName1.Split('.').Length - 1;
if (count > 1)
{
//return "Double extension not allowed in ";
return "{success:false, imsg:\"Double extension are not allowed in File-Name, please rename and try again.\"}";
}
if (indexOf != -1)
{
//return "Special character not allowed in ";
return "{success:false, imsg:\"Special character are not allowed in File-Name, please rename and try again.\"}";
}
string mimetype = Request.ContentType;
if (mimetype == "image/jpeg" || mimetype == "image/jpg" || mimetype == "image/pjpeg"
|| mimetype == "application/jpg" || mimetype == "application/x-jpg" || mimetype == "image/pipeg" || mimetype == "image/vnd.swiftview-jpeg"
|| mimetype == "image/x-xbitmap" || mimetype == "application/octet-stream")
{
if ((ext.ToLower() == ".jpg") || (ext.ToLower() == ".jpeg"))
{
fn = "";
string fFullName = filename;
int len = fFullName.Length;
string ext1 = Path.GetExtension(fFullName);
string str = fFullName.Substring(fFullName.LastIndexOf("\\") + 1);
len = str.Length;
string fileN = str.Substring(0, len - ext1.Length);
Regex FilenameRegex = null;
FilenameRegex = new Regex("(.*?)\\.(jpeg|jpg|JPEG|JPG)$", RegexOptions.IgnoreCase);
int index = fileN.IndexOf(".");
Gaurav Gupta A Tech Guy
23-Jan-15 0:13am
View
problem still persist of certificate error ?
Gaurav Gupta A Tech Guy
21-Jan-15 5:41am
View
but how to do it if i don't have access to server. i do have only ftp access..
and also i wanted to remove security certificate problem by rewriting all urls to https://mywebsite.co.in
Gaurav Gupta A Tech Guy
24-Sep-14 8:46am
View
it will not solve my problem. i already know this. but for very frequent transaction. it might not work..
Gaurav Gupta A Tech Guy
24-Sep-14 8:44am
View
Requirement is that i need to submit student record for their papers but condidtion is that we can't allow them to have above 3 paper for a login id. so if two candidate open the page same time with same page with same credential. so both should not be allowed.
Gaurav Gupta A Tech Guy
26-Aug-14 2:54am
View
No all this will not work.. i already know how to get public ip for any browser and mac address for internet explorer of client machine where client browse our web application....
but what i need is that private ip mean LAN address ex-192.168.0.2 of client machine as well as mac address from any browser....
Gaurav Gupta A Tech Guy
26-Aug-14 2:15am
View
Bro....this will not work. because i need client machine public and private ip address not server details...there will give you only server details....
Gaurav Gupta A Tech Guy
11-Aug-14 6:21am
View
Kindly please tell me... how ?
Gaurav Gupta A Tech Guy
7-Aug-14 7:40am
View
<br />
<asp:FileUpload ID="fileupMember" runat="server" />
<br />
<br />
<asp:ImageButton ID="upload" OnClick="upload_Click" runat="server" ImageUrl="~/images/save.png"
Height="20" Width="50" OnClientClick="javascript:fillImageUrl()" />
string fFullName = fileupMember.PostedFile.FileName;
int len = fFullName.Length;
string ext = Path.GetExtension(fFullName);
string str = fFullName.Substring(fFullName.LastIndexOf("\\") + 1);
len = str.Length;
string fileN = str.Substring(0, len - ext.Length);
Regex FilenameRegex = null;
FilenameRegex = new Regex("(.*?)\\.(htm|html|asp|aspx|php|jsp|pdf|doc|docx|xls|xlsx|ppt|pptx|HTM|HTML|ASP|ASPX|PHP|JSP|PDF|DOC|DOCX|XLX|XLSX|PPT|PPTX)$", RegexOptions.IgnoreCase);
int index = fileN.IndexOf(".");
if (!FilenameRegex.IsMatch(fFullName) || index != -1)
{
return "";
}
string Photoname = Path.GetFileNameWithoutExtension(fileupMember.PostedFile.FileName);
string fileSize = fileupMember.PostedFile.ContentLength.ToString();
String ImageFileNameMBA = fileupMember.PostedFile.FileName;
HttpPostedFile ImageFileMBA = fileupMember.PostedFile;
Byte[] stu_imageMBA = new Byte[ImageFileMBA.ContentLength];
Stream fs = fileupMember.PostedFile.InputStream;
fs.Read(stu_imageMBA, 0, Convert.ToInt32(fileSize));
fs.Seek(0, SeekOrigin.Begin);
StreamReader sr = new StreamReader(fs, true);
string firstLine = sr.ReadLine().ToString();
//string firstLine = "JFIF";
if ((firstLine.IndexOf("%PDF") > -1))
{
return;
}
String[] allowedExtensions = { ".pdf" };
String[] allowedMimeType = { "application/pdf" };
for (int i = 0; i < allowedExtensions.Length; i++)
{
if (FileExtension == allowedExtensions[i])
{
FileOK = true;
}
}
if (FileOK == true)
{
for (int i = 0; i < allowedMimeType.Length; i++)
{
if (fileupMember.PostedFile.ContentType == allowedMimeType[i])
{
FileOK1 = true;
}
}
}
if (FileOK == true)
{
fileupMember.PostedFile.SaveAs(Server.MapPath("./filelocation"));
}
Gaurav Gupta A Tech Guy
28-Jul-14 6:22am
View
Yes....i got it.....i will try this. i will inform you if get succussfull......
Gaurav Gupta A Tech Guy
24-Jul-14 2:11am
View
i am using Microsoft.Practices.EnterpriseLibrary.Data library for database connection...so what should i do now....
Gaurav Gupta A Tech Guy
24-Jul-14 2:10am
View
i am using Microsoft.Practices.EnterpriseLibrary.Data library for database connection...and it automatically open and close db connection... so what should i do now....
Gaurav Gupta A Tech Guy
16-Jun-14 8:28am
View
Have tried it....it is a bit difficult to customize....
Gaurav Gupta A Tech Guy
14-Apr-14 8:19am
View
Yeah..... I know that...but i read one of blog on internet saying that sync behavior do not supported by all browser..........i know that it can not but have created confusion that's why i asked.
Gaurav Gupta A Tech Guy
14-Apr-14 7:36am
View
Yeah it is working now.....Thank you. But it will work on all browser or not for sync ?
Gaurav Gupta A Tech Guy
14-Apr-14 7:08am
View
Whether sync method will be supported by all browsers ?
Gaurav Gupta A Tech Guy
14-Apr-14 5:06am
View
ok...thank you for your suggestion..Plz help me find out above problem..
Gaurav Gupta A Tech Guy
14-Apr-14 5:03am
View
I checked, Problem is very strange.. When i debug then i found that after calling above function i called confirm box... but confirm box comes first before completion of ajax request... and when i press ok. then it goes back to ajax call and throws into error part of ajax.... thats why it does not able to check span value correctly. So one more problem is confirm box fired first before ajax completion....
And if i do not put confirm or alert after the function...so it does not show error msg and submits the form to server.....
Gaurav Gupta A Tech Guy
14-Apr-14 4:36am
View
function chkValidDetails() {
var isRet = "0";
$.ajax({
url: '@Url.Action("GetCourseEligibility", "Master")',
data: { mapid: midd, challaNo: challod },
dataType: 'json',
success: function (data) {
debugger;
//alert("testug");
$.each(data, function (key, value) {
debugger;
if (value != null) {
if (catid == "3" || catid == "4") {
if (value.MinResvMarksPercent != null) {
if (value.MinResvMarksPercent != "" && value.MinResvMarksPercent != "null") {
if (perc < parseFloat(value.MinResvMarksPercent)) {
$("#errug").text("You do not have minimum required percentage " + value.MinResvMarksPercent + " for selected UG eligibility.");
//isRet = "1";
$("#chkmarks").val("1");
$("#errdtlall").val("You do not have minimum required percentage " + value.MinResvMarksPercent + " for selected UG eligibility.");
//errugajx.text("You do not have minimum required percentage " + value.MinResvMarksPercent + " for selected UG eligibility.");
}
}
}
}
else {
if (value.MinGenMarksPercent != null) {
if (value.MinGenMarksPercent != "" && value.MinGenMarksPercent != "null") {
if (perc < parseFloat(value.MinGenMarksPercent)) {
$("#errug").text("You do not have minimum required percentage " + value.MinGenMarksPercent + " for selected UG eligibility.");
//isRet = "1";
$("#chkmarks").val("1");
$("#errdtlall").val("You do not have minimum required percentage " + value.MinGenMarksPercent + " for selected UG eligibility.");
//errugajx.text("You do not have minimum required percentage " + value.MinGenMarksPercent + " for selected UG eligibility.");
}
}
}
}
}
});
},
error: function () {
debugger;
$("#errug").text("Details not found. Please relogin to save details");
isRet = "1";
$("#chkmarks").val("1");
$("#errdtlall").val("Details not found. Please relogin to save details");
//errugajx.text("Details not found. Please relogin to save details");
}
});
if ($("#chkmarks").val() == "1") {
return "0";
}
}
i call above function on form submit i assign value in any span errugajx, $("#errdtlall"), $("#errug"). it does not take it and it remains blank untill i call alert or confirm.
Gaurav Gupta A Tech Guy
11-Apr-14 0:32am
View
No code snapshot is required. i defined my variable as datetime in model. and it is being validated automatically through jquery.validate.unobtrusive.min.js. and only set dataannotations for date format string.
Gaurav Gupta A Tech Guy
29-Mar-14 2:14am
View
It is showing me error....
Servidor de error 404 !! error is parseerror
What should i do now ?
Gaurav Gupta A Tech Guy
5-Mar-14 5:20am
View
the problem is that if someone asked me about approaches to develop MVC Application. so what will me my answer ? thats why i am asking about term like code first and database first.
Gaurav Gupta A Tech Guy
5-Mar-14 5:20am
View
the problem is that if someone asked me about approaches to develop MVC Application. so what will me my answer ? thats why i am asking about term like code first and database first.
Gaurav Gupta A Tech Guy
24-Dec-13 2:48am
View
I woukd like to ask you that i want to execute a SMS URL by this method at server end. because may be there are permission of SMS api url at server end only ?
Gaurav Gupta A Tech Guy
20-Dec-13 23:35pm
View
Can any one tell me that this function WebClient.OpenRead exceutes at client end or server end in web application ?
Gaurav Gupta A Tech Guy
2-Dec-13 5:51am
View
This is becoz i have a client to which i need to provide high level security. and i must implement MAC level security.Plz assist me ?
Gaurav Gupta A Tech Guy
1-Dec-13 3:10am
View
So tell me a way to identify a user machine over the web application ?
Or is there any way to get MAC address whether it is gud or not ? Please tell me the way to get it through ActiveX control if no other solution is there ?
Show More